I have created the following controller in Angular, and I'm trying to access some child objects in the returned JSON.
Controller:
var app = angular.module("MyApp", []);
app.controller("FAQCtrl", function($scope, $http) {
$scope.dataLoaded = false;
$http.get('config/data.json', {
})
.success(function(data, status, headers, config) {
$scope.config = data;
$scope.dataLoaded = true;
}).
error(function(data, status, headers, config) {
window.alert("Sorry! There has been a problem!\n\nPANIC!")
});
});
The JSON that's returned is in this format :
{
"entryList":
{
"totalEntries": 237,
"incEntries": 10,
"offset": 0,
"loggingURL": "/action/logStatistics?action1=%27client%d%27",
"entry":
[
{
"catID": "delivery",
"entryID": "delivery-charges",
"subcatID": "delivery-options",
"question": "What are your delivery charges?"
},
{
"catID": "returns-and-refunds",
"entryID": "online-returns-policy",
"subcatID": "returns-policy",
"question": "What is your online returns policy?"
},
{
"catID": "delivery",
"entryID": "track-delivery",
"subcatID": "order-status",
"question": "How can I track my delivery/order?"
},
{
"catID": "delivery",
"entryID": "click-and-collect",
"subcatID": "delivery-options",
"question": "Do you offer Click and Collect or Collect +?"
},
{
"catID": "products-and-services",
"entryID": "makeover",
"subcatID": "services",
"question": "Can I come in for a free makeover and skin consultation?"
},
{
"catID": "delivery",
"entryID": "how-long-for-delivery",
"subcatID": "delivery-queries",
"question": "How long will it take for my products to be delivered?"
}
]
}
}
I'd like to be able to return the details of each of the "entry" sections of the feed, but I'm struggling to make the following work:
<div ng-repeat="item in entryList">
<a href="" class="btn btn-info btn-lg btn-block">{{item.entryID}}</a>
<br />
</div>
Could any one give me an idea on how I can easliy access the child sections?
Thanks