I want to parse JSON in AngularJS. I use $stateParams in this controller
rerunApp.controller('rerunCategoryListCtrl', function($scope, $http, $stateParams) {
var stpNameCat = $stateParams.nameCat;
$http.get(JSON URI).success(function (data, status) {
var response = data.Items.stpNameCat;
console.log(response);
});
});
My JSON is below.
{
cacheFileUpdate: 1435651202,
- Items: {
+ newsProgram: [...],
+ entertainProgram: [...],
+ documentaryProgram: [...],
+ benefitProgram: [...],
+ kidsProgram: [...],
+ dramaProgram: [...],
+ oldProgram: [...],
+ etcProgram: [...]
}
}
When I run this app. I want to get item in each Items such as $stateParams is newsProgram, output is item in newsProgram. But it error at data.Items.stpNameCat. How can I fix it or have some method ? Thanks a lot.