Reputation:
html
<select ng-model="selectLocation" ng-options="key for key in careerlist.location | orderBy: 'key'">
js (in careerlist controller)
location = ["US-CA-San Clemente", "US- UT- Draper", "US-TX-Dallas", "US-LA-New Orleans", "US-WI-Oshkosh", "US-SC-Charleston", "US-UT-Provo", "US-TX-Fort Worth"]
The select option is populated and functions as intended when making a choice, but it doesn't sort it by alphabetical order.
Upvotes: 0
Views: 848
Reputation: 749
This seems to be a duplicate of this question. Never the less, if you don't want to read that link, can you tell me if this work?
ng-options="key for key in careerlist.location | orderBy:'toString()' "
Using toStrig works because you are just using a list of strings.
Upvotes: 0