0

I have list of messages which should be displayed in descendig order. That is recent one should be displayed at top and i need to show index order in descending.

say for example i have 3 values to display.

third message #3
second message #2
first message #1

am using ng-repeat with table, but index always comes in ascending order. ($index+1)=1

is there anyway i can reverse the index or i need to have any counter and decrement it.

my html is like below,

<table id="tbl1" ng-show="(model.message).length">
<tbody ng-repeat="item in model.message">
<tr>
<td>{{item.comments}}</td>
<<td>#{{$index+1}}</td>
</tr>
</tbody>
</table>

index displayed here like #1,#2,#3 etc., but i want it like #3,#2,#1. any way to acheive this?

I have ordered data in sql itself, so no need to reverse here. Just wanted to reverse index alone.

Govind
  • 979
  • 4
  • 14
  • 45

0 Answers0