I have a ng-repeat who loop on users.
JSON :
$scope.peoples = {
"users": [{
"name": "Quentin",
"id": 0,
"email": "toto@gmail.com",
"points": "0",
"sneakers": [{
"name": "Jordan 1",
"img": "https://www.flightclub.com/media/catalog/product/cache/1/image/800x570/9df78eab33525d08d6e5fb8d27136e95/8/0/800564_1.jpg"
}, {
"name": "Dunk",
"img": "https://sneakerbardetroit.com/wp-content/uploads/2015/06/nike-sb-dunk-low-primitive-p-rod-2.jpg"
}, {
"name": "SB",
"img": "http://www.nozbone.com/media/catalog/product/cache/1/small_image/295x/040ec09b1e35df139433887a97daa66f/n/i/nike-sb-blazer-vapor-black-white.jpg"
}, {
"name": "Air Max",
"img": "http://www.chausport.com/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/1/1/11637-chaussures-nike-air-max-95-ultra-essential-grise-vue-exterieure.png"
}]
}, ... ]
And the HTML :
<div class="battle">
<div class="battle_block" ng-repeat="user in users | limitTo: 2 | orderBy: random">
<h3>{{user.name}}</h3>
<span>{{user.points}}</span>
<button ng-click="vote(user)">Vote</button>
</div>
</div>
And the random filter inside my controller (founded in another Stackoverflow post) :
$scope.random = function() {
return 0.5 - Math.random();
};
My problem is the ng-repeat always begin by the both same users who are the first in the json (Quentin &the second one). I would like to begin by random users everytime, but for the moment, I didn't succeed.