I have a complicated response from an http request as shown below:
"rates": [
{
"non_refundable": false,
"no_of_rooms": 1,
"includes_wifi": false,
"includes_boarding": true,
"has_promotions": true,
"group_code": "xgirbylkwb6xtg",
"currency": "INR",
"cancellation_policy": {
"under_cancellation": false,
"details": [
{
"from": "2016-12-25T00:00:00",
"flat_fee": 20309.01,
"currency": "INR"
}
],
"cancel_by_date": "2016-12-24T00:00:00",
"amount_type": "value"
}
}
]
Rates length is between 6-20 inside another array with length of around 200.
The "cancellation_policy"shows up only if "non_refundable": false.
How I can access "from": "2016-12-25T00:00:00" and change the format with Moment JS and how I can access "flat_fee": 20309.01?
I tried using angular.forEach already but it defines only the value of last array .
I tried this already:
if ($scope.data[i].rates[j].non_refundable == false) {
for (var d = $scope.data[i].rates[j].cancellation_policy.details.length - 1; d >= 0; d--) {
But I had no success.
ps:
The value should show on $mdDialog