I have a md-autocomplete field:
<md-autocomplete md-selected-item="videoInfo.lineUp[1]" md-items="item in searchQuery(searchText1)" md-search-text="searchText1" md-item-text="item.display" md-floating-label="Loosehead">
<span md-highlight-text="searchText1">{{item.display}}</span>
</md-autocomplete>
I populate md-items
with
$scope.searchQuery = function (searchText) {
var users = [];
angular.forEach($scope.users,
function (value, key) {
// value = user object
// key = userId
var dN = value["display_name"];
if (dN) {
var obj = {};
obj[key] = value;
obj["display"] = dN;
if (dN.toLowerCase().indexOf(searchText.toLowerCase()) !== -1) {
users.push(obj);
}
}
});
return users;
}
Is there a way to order the items in the dropdown alphabetically?
md-items="item in searchQuery(searchText1) | orderBy : display"