0
我有一個漫畫閱讀網站,我試圖用AngularJS重建。AngularJS ng-repeat嵌套JSON數據
這裏是JSON數據:
[
{
"name": "Bleach",
"random": [
{
"chapter": "787",
"Paths": [
"path/to/1.jpg",
"path/to/2.jpg",
"path/to/3.jpg"
]
},
{
"chapter": "788",
"Paths": [
"path/to/1.jpg",
"path/to/2.jpg",
"path/to/3.jpg"
]
}
]
},
{
"name": "Naruto",
"random": [
{
"chapter": "332",
"Paths": [
"path/to/1.jpg",
"path/to/2.jpg",
"path/to/3.jpg"
]
},
{
"chapter": "333",
"Paths": [
"path/to/1.jpg",
"path/to/2.jpg",
"path/to/3.jpg"
]
}
]
}
]
欲順序顯示這些圖像。 Like this。但是在這個當前的代碼中沒有顯示。
相關oku.html部分:
<img ng-repeat="bilgi in bilgiler.random" ng-src="http://localhost/{{bilgi.paths}}">
App.js:
$stateProvider
.state('oku', {
url: "/oku/:name/:id",
views: {
"viewC": { templateUrl: "oku.html",
controller: "nbgCtrl",},
},
resolve: {
alData : function(NBG, $stateParams, $filter){
return NBG.adlar.then(function(res){
return $filter('filter')(res.data, {chapter: $stateParams.id}, true)[0];
});
}
}
})
.controller('nbgCtrl', function($scope, alData, NBG) {
$scope.images = alData;
NBG.adlar.success(function(verHemen){
$scope.bilgiler = verHemen;
})
})
使用本: '' – Sandeep
請格式化您的代碼。 –