-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(orderBy): support sorting by value #5847
Conversation
I'm sorry, but I wasn't able to verify your Contributor License Agreement (CLA) signature. CLA signature is required for any code contributions to AngularJS. Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match. If you signed the CLA as a corporation, please let us know the company's name. Thanks a bunch! PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR. |
CLA signed |
CLA signature verified! Thank you! Someone from the team will now triage your PR and it will be processed based on the determined priority (doc updates and fixes with tests are prioritized over other changes). |
@ilanbiala FYI, there's a workaround for this is in the mean time:
|
Sure, here's a fiddle. |
@marshall007 That only works for strings though, I just want to reverse an array and not have to do things like $scope.$watch and $scope.$observe and all that if Angular can do it for me. I hope this will get merged into 1.3.0-beta18 so i can test it out. |
@ilanbiala This PR won't help you then, but it sounds like you could just use a filter. Here's another fiddle. |
Thanks! |
02dc2aa
to
fd2d6c0
Compare
@marshall007 thanks for providing this patch but it can be done more consistently without having to ignore the various corner cases in a slightly different way. See #9403 |
@petebacondarwin no problem, glad to see this finally resolved! |
Fixes issue #4579, adding support for:
<p ng-repeat="item in items | orderBy">{{item}}</p>
<p ng-repeat="item in items | orderBy:'+'">{{item}}</p>
<p ng-repeat="item in items | orderBy:'-'">{{item}}</p>
It seems unnecessary and redundant in this particular scenario to support the
reverseOrder
parameter and takingsortPredicate
as an array, so they are ignored (i.e. the following):<p ng-repeat="item in items | orderBy:'+':false">{{item}}</p>
<p ng-repeat="item in items | orderBy:['+']">{{item}}</p>