I have been trying to use ng-options
to display an array of fonts in a select sorted alphabetically by the value of the items in the array.
HTML
<select ng-options="font for font in webfonts | orderBy:'font'" name="fonts">
<option value="">Choose a font</option>
</select>
JS
$scope.webfonts = [
'Abel', 'Crafty Girls' , 'Lato' , 'Average',
'Corben', 'Quicksand', ... ];
I've tried changing the value in orderBy
and other things. I've read through the documentation and all comments.
What am I missing? Is this supposed to only work on objects?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…