I'm writing an API on NodeJS (server part) and AngularJS (view part) which asks another API (NodeJS too) to get an object containing stuff including an array of pictures. I'm interested by the pictures in this array.
I wrote a for loop to get names of all pictures contained in my array of pictures in my object:
for(j=0; j<reference.pictures.length; j++){
self.url ="http://localhost:3000/api/pictures/"+reference.pictures[j].picture;
self.urlArray = urlArray.push(self.url);
}
console.log(urlArray);
And I wrote for my view an ng-repeat:
<div ng-repeat="url in urlArray">
<img ng-src="{{url}}" width="150px"/>
<br/>
</div>
My problem ? I can see my urls contained in my array of urls in log when I console.log BUT I can't see 'em in my view with my ng-repeat. I guess my ng-repeat isn't perfect but still don't know why Any ideas ?
To understand, I want to show all my pictures contained in my array so FIRST I did that:
controller:
self.url = "http://localhost:3000/api/pictures/"+reference.pictures[j].picture;
view:
<div ng-repeat="picture in reference.pictures">
<img ng-src="{{url}}" width="150px"/>
<br/>
</div>
and in result I have the good number of pictures, BUT the URL used to get pictures is the last one which is assigned exiting the loop, so all my pictures are the same (the last one), this is why I get the idea to make an array with all my different URL