I´m trying to use orderBy within a ng-repeat but it´s not working.
This is where I create and populate the array used on the ng-repeat:
for (var k = 0; k < $scope.allUsers.length; k++)
{
var score =
{
points: 0,
headshot: 0,
winners: 0,
};
$scope.currentScore.push(score);
}
And here is where I call it:
<tr ng-repeat="singleScore in currentScore | orderBy: 'points'">
<td>{{singleScore.points}}</td>
<td>{{singleScore.headshot}}</td>
<td>{{singleScore.winners}}</td>
</tr>
This "currentScore" array is changed from time to time in a setInterval function and its values are being correctly updated.. but the orderBy never works.
I know there are a lot of similar questions but almost all are resolved with "you are not using an array".. but I am indeed using an array and it´s still not working.
What am I doing wrong?
EDIT: Solved with:
$interval($scope.calculateWeekScore, 2000, 10, true, $scope.activeWeek);
Thanks!