lundi 24 avril 2017

$rootScope:infdig after randomizing ng-repeat

I want to randomize my filtered data from Firebase. Unfortunetaly, after using my orderBy: random, I receive error with $rootScope:infdig. I read about it, but I can't figure out how can I solve it and randomize my output from Firebase. Here is my code:

HTML:

<div ng-repeat="place in places | filter: {cheap: 'true'} | limitTo: 4 | orderBy: random" class="col-lg-3">

JS:

// Random order by
   $scope.random = function() {
     return 0.5 - Math.random();  
   };

I'd be very grateful if you can help me!




Aucun commentaire:

Enregistrer un commentaire