Now I got it! If you go by with the array ( locations2 ), you can use the orderBy filter <https://docs.angularjs.org/api/ng/filter/orderBy> to sort by name. Ex: ng-options="location.id as location.name for location in locations2 | orderBy:'name'"
But, if you want to go by the associative array, the simplest ( not the best ) way is to create a method which returns an array with the objects already ordered. Ex: ng-options="location.id as location.name for location in getOrderedLocations()" On Sunday, May 25, 2014 3:50:11 PM UTC-3, Ryan Watson wrote: > > I am doing something similar to this: > > http://jsfiddle.net/hvnHL/ > > I used this post to figure out how to loop though my array. Basically I am > looping though a C# Dictionary with an int as the key and a custom class as > the value. > > -- 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.
