I'm using AngularJS to create a table of data. Since Angular allows you to filter and order the data in the controller, is there a way to specify an incremental value?
For example:
Rank | UserName | Score | Last Played
Here The ranking is going to be ordered by the highest score.
What would be the angular expression to set the Rank accordingly?
From: Increment A Variable In AngularJS Template
{{$index + 1}}
$index contains the current 0-based index for ng-repeat
So I have:
<tbody>
<tr ng-repeat="user in users">
<td>{{$index + 1}}</td>
<td>{{user.UserName}}</td>
<td>{{user.Score}}</td>
<td>{{user.LastPlayed}}</td>
</tr>
</tbody>