AngularJS ng-repeat is not picking values

1

I am returning a json with this code:

$scope.movies = angular.toJson(results, true);

and getting this json: link

And trying to get the data with this:

<ion-item ng-repeat="movie in movies">
    {{movie.title}}
</ion-item>

but I was having an error:

  

Error: [ngRepeat: dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys.

So I tried this:

 <ion-item ng-repeat="movie in movies track by $index">
     {{movie.title}}
 </ion-item>

But now I can not get the values. {{movie.title}} returns empty.

    
asked by anonymous 05.05.2014 / 20:21

1 answer

2

I do not understand why you are transforming the object into a JSON string. It does not seem appropriate to me.

Tip 1:

$scope.movies = results.data.results;

And use your original HTML:

<ion-item ng-repeat="movie in movies">
    {{movie.title}}
</ion-item>

Tip 2:

$scope.movies = results;

And in HTML:

<ion-item ng-repeat="data.results in movies">
    {{movie.title}}
</ion-item>
    
05.05.2014 / 20:38