1

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?

Noor A Shuvo
  • 2,639
  • 3
  • 23
  • 48
  • missing double quote – saiyan Jul 30 '18 at 12:28
  • Sorry, missed that by mistake. But this is not the cause. Edited the question. – Noor A Shuvo Jul 30 '18 at 12:31
  • can you put closeRFI method here? – saiyan Jul 30 '18 at 12:40
  • Its working right, [fiddle](http://jsfiddle.net/0tgL7u6e/416/). – Durga Jul 30 '18 at 12:41
  • I am reluctant to re-open this question. The question needs a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). As it is written the error can not be re-produced, as the Fiddle by @Durga shows. [From review](https://stackoverflow.com/review/reopen/20451632). – georgeawg Aug 01 '18 at 02:22
  • Get the solution. :) What happened here is, `rfiList[index]` was creating the problem. As `rfiList` is ordered by `orderby`, I thought, list is ordered automatically. But my thought was wrong. The solution I make here is, pass the rfi in `closeRFI` method i.e. `closeRFI(rfi)`. It solved my problem. – Noor A Shuvo Aug 01 '18 at 04:17

0 Answers0