Reputation: 4679
I'm having trouble sorting larger Arrays with an angularFireCollection binding:
$scope.offers = angularFireCollection(new Firebase(url));
while having in my template the code:
<tr ng-repeat="offer in offers | limitTo:100 | orderBy:'createdTimestamp':true">
While the offers.length is < 100, new items are correctly displayed on top. After 100 items, the sorting stops working at all.
Upvotes: 1
Views: 580
Reputation: 21079
The issue is your expression order. "offer in offers | limitTo:100 | orderBy:'createdTimestamp':true"
first gets the first 100 elements of offers
, then orders. What you want is to order, then limit, so you want to use the string "offer in offers | orderBy:'createdTimestamp':true | limitTo:100"
. You can see what I mean in the following jsFiddle, where the first list limits the array and then tries ordering while the second orders, then limits: http://jsfiddle.net/qE5P9/1/.
Upvotes: 4