I want to show the serial number for table data, which is populated with ng-repeat
. The code I have is as follows
<tr ng-repeat="usageRecord in applicationUsageDataForReport">
<td style="text-align: center"><span>{{$index+1}}</span></td>
<td style="padding-left: 5px; max-width: 200px; text-align: center; width:100px;">
<span>{{usageRecord.ibu}}</span>
</td>
</tr>
which is working fine. Serial numbers do as expected. But when I add the condition in ng-repeat
with ng-if
, the value $index
is only suitable for those records that satisfy the condition that produces the serial number in some order. What alternative can I use to get the serial number in the correct order (1,2,3 ..)
source
share