Today in, "there's got to be a way to do this", if you want to use orderBy
on an ng-repeat (I find the orderBy docs to be a little thin), but sort on
more than just one field, you can pass an array in to the orderBy predicate:

My ng-repeat wants to sort communities by name, but preferentially show
official communities first (apparently false comes before true, I guess
alphabetically), so with strings in community.name and a boolean literal in
community.official, I can do this:

community in view.allCommunities | orderBy:['-official','name'] |
filter:communityTypeFilter | filter:{name: view.newCommunityTitle} track by
community.$id

note the orderBy:['-official', 'name'] syntax. I was originally screwing
around with multiple orderBy filters and stuff. This way works nicely.

e

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to