I am having trouble extracting information from a JSON string that I have (see image below).
{
all: [{
info: {
name: "Fahad",
lat: "41.954815",
lon: "-87.647209"
}
}, {
info: {
name: "Fahad",
lat: "41.954815",
lon: "-87.647209"
}
}, {
info: {
name: "Fahad",
lat: "41.954815",
lon: "-87.647209"
}
}],
rowsfound: "11"
}
I am attempting to access this data using angularjs, here is the HTML code:
<ul ng-controller="PostsCtrl">
<li ng-repeat="post in posts">
{{post.all[0].info.name}} <em>{{post.rowsfound}}</em>
</li>
</ul>
Controller setup for reference:
app.controller("PostsCtrl", function ($scope, $http) {
$http.get(myurl)
.success(function (data) {
$scope.posts = data;
}).error(function (data, status, headers, config) {
alert("error");
});
});
When I load the page, two list items are generated but they do not display any values. What could be causing this issue?
Thank you.