Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Using order by with List that is track by $index does not perform sorting #8334

Closed
piu opened this issue Jul 25, 2014 · 3 comments
Closed

Using order by with List that is track by $index does not perform sorting #8334

piu opened this issue Jul 25, 2014 · 3 comments

Comments

@piu
Copy link

piu commented Jul 25, 2014

Hello there,

I am using performing sorting in our angularJS application using Orderby. But when triing to sort the list that is track by $index it doesn't work.

Tried doing the same in the example for orderBy (https://docs.angularjs.org/api/ng/filter/orderBy) on angularJS official website through Plunker and it seems to be issue there too

http://plnkr.co/edit/IYSitUaZpLK8YCHnJvqY?p=preview

@mkwiatkowski
Copy link

Documentation for ngRepeat mentions that:

Filters should be applied to the expression, before specifying a tracking expression.

So try this instead:

ng-repeat="friend in friends | orderBy:predicate:reverse track by $index"

@piu
Copy link
Author

piu commented Jul 25, 2014

Thanks got the issue resolved 👍

@rahmadfirman59
Copy link

thanks, it's _work

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants