I have a List of cars assigned to a person for a particular month. If you search April you will get April data. How do I access Nested JSON data via Index?
Here's plunker
$scope.cars = $scope.results[resultIndex].cars.map(function(car) {
return {
make: car.Make,
year: car.Year
};
});
$scope.showCars = function(resultIndex) {
$scope.cars = $scope.results[resultIndex].cars;
};
"April": [{
"Name": "Tim",
"Address": "Street",
"Phone": "111",
"Status": "Speeding",
"cars": [
{
"Make": "Honda",
"Year": "2000"
},
{
"Make": "Ford",
"Year": "2010"
},
{
"Make": "Toyota",
"Year": "2004"
}
]},