javascript - Ionic: Why are my images not loading from my json file? -


i'm trying load images json file application cannot work:

here's code:

js:

.controller('photoctrl', function($scope, $ionicmodal, $ionicbackdrop, $ionicscrolldelegate, $ionicslideboxdelegate, $http) {    $scope.images = [];      $scope.getimages = function() {         $http.get('https://api.myjson.com/bins/37ia6')             .success(function(data) {                 $scope.images = data.images;             })     } 

html:

<ion-view view-title="gallery" align-title="center" ng-controller="photoctrl" >    <ion-content ng-init="getimages()" class="center" class="has-header padding">      <!-- start under6/7/8/9s photos -->     <div class="item item-divider">       <i class="ion-images"></i> under6/7/8/9s photos     </div>     <a class="item item-list-detail">       <ion-scroll direction="x">         <img on-hold="onhold()" ng-repeat="image in images" ng-src="{{images.src}}" ng-click="showimages($index)" class="image-list-thumb" />       </ion-scroll>     </a> </ion-content> </ion-view> 

i think reason in json. expect happen when iterating over:

{"images":"http://cdn.caughtoffside.com/wp-content/uploads/2012/07/marko-marin.jpg"} 

probably api should return array of objects like

[{"src":"http://cdn.caughtoffside.com/.../marko-marin.jpg"},  {"src":"http://cdn.caughtoffside.com/.../johnny-blue.jpg"},  ... ] 

iterating on object looks different:

<div ng-repeat="(key, value) in myobj"> 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -