I have a div in which I use ng-repeat. What I have done is repeating the rfi
from the rfiList
.
<div ng-repeat="rfi in rfiList | orderBy:['isDone','-CreatedDate'] track by $index">
<button ng-click="closeRFI($index)">Close</button>
</div>
In the method closeRFI($index)
, i am accessing the rfiList using the index
var record = $scope.rfiList[index];
What is happening here is, when I want to access the rfiList
using the index, the rfiList
remains a list before orderby. That is, it seems orderby is not applying in the rfiList and thus index is not changing.
How can I order the rfiList
so that the index is changed?