Reputation: 355
I have a manga reading website and I trying to rebuild with AngularJS.
Here is JSON Data:
[
{
"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"
]
}
]
}
]
I want to display these images sequentially. Like this. But in this current code nothing displayed.
Related oku.html part:
<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;
})
})
Upvotes: 0
Views: 168
Reputation: 3365
You need to use some form of wrapper for your repeat. For example:
<div ng-repeat="bilgi in bilgiler.random">
<img ng-src="{{bilgi.Paths}}" />
</div>
You can also use span, li tags etc. More data on ng-repeats can be found here: https://docs.angularjs.org/api/ng/directive/ngRepeat
Upvotes: 1