I am really having a hard time repeating nested objects that are loaded from a json file. I have seen examples of people using dot notations in their HTML for retrieving nested data in JSON, but I can't figure out how this would work for me. The JSON is valid, but I am new to Angular. Could somebody give me a push in the right direction? I would like to enter the name of my menu-card and display it in separate lists. This is what I have and it does not work, (the console does not give me any errors if you are wondering):
<div ng-controller="menu" ng-repeat="item in menu.voorgerecht">
<div>{{item.naam}}</div>
</div>
js
angular.module("app", [])
.controller("menu", function ($scope, $http) {
$scope.menu = null;
$http({
method: 'GET',
url: 'menu-items.json'
}).succes(function (data, status, headers, config) {
$scope.menu = data;
}).error(function (data, status, headers, config) {});
});
json
{
"voorgerecht": [
{
"naam": "Sardine"
},
{
"naam": "Funghi Trifolati"
}
],
"pizza": [
{
"naam": "San Marco"
},
{
"naam": "Capriciosa"
}
],
"desert": [
{
"naam": "Sorbet"
},
{
"naam": "Dame Blanche"
}
]
}