0

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;
})
})
2
  • use this: <span ng-repeat="bilgi in bilgiler.random"><img ng-repeat="img in bilgi.Paths" ng-src="http://localhost/{{img}}"></span> Commented Oct 5, 2015 at 18:43
  • Please format your code. Commented Jan 23, 2016 at 13:38

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.