I am using the ng-options="ref as display for (ref, display) in
syntax to display a non-array object as a dropdown, but am having trouble ordering the dropdown values.
How should I use the orderBy
filter to sort this dropdown by display
value?
<div ng-controller="MyCtrl">
<select name="category" type="text" ng-model="categories " ng-options="ref as display
for (ref, display) in categories | orderBy:'display'" >
</div>
var myApp = angular.module('myApp',[]);
function MyCtrl($scope) {
$scope.categories = {
cat2: "Category 2",
default: "anone",
zone: "zone",
};
}