Angular.js: Using order by with List that is track by $index does not perform sorting

Created on 25 Jul 2014  路  3Comments  路  Source: angular/angular.js

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

Most helpful comment

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"

All 3 comments

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"

Thanks got the issue resolved :+1:

thanks, it's _work

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lanterndev picture lanterndev  路  74Comments

coli picture coli  路  60Comments

guruward picture guruward  路  145Comments

georgiosd picture georgiosd  路  124Comments

cgross picture cgross  路  194Comments