I am using orderBy to order the drop down list but it is not working . Can someone please suggest on this ? Please let me know if you need any other information ..
<select class="selectbox form-control" class="form-control" data-ng-model="ctrl.task.delegateFromId" data-ng-options="user.marsId as user.fullName for user in ctrl.userList | orderBy:'fullName' ">
<option value="">-- Select Area Owner --</option>
</select>
here is plunker for this question 1st drop down order by is working but for 2nd it is not working
I don't know what is your problem but i put simple example.
var myapp = angular.module('myapp', []);
myapp.controller('Ctrl', function ($scope) {
var vm = this;
vm.userList =JSON.parse('{"11":{"marsId":"11","firstName":"cc","lastName":"cc","fullName":"cc cc"},"12":{"marsId":"12","firstName":"aa","lastName":"aa","fullName":"aa aa"},"45":{"marsId":"45","firstName":"kk","lastName":"kk","fullName":"kk kk"}}');
vm.userList2 = [];
for (var key in vm.userList) {
var tempObj = "";
tempObj = vm.userList[key];
vm.userList2.push(tempObj);
}
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="myapp" ng-controller="Ctrl as vm">
<select class="selectbox form-control" class="form-control" data-ng-model="vm.task.delegateFromId" data-ng-options="user.marsId as user.fullName for user in vm.userList2 | orderBy:'fullName' ">
<option value="">-- Select Area Owner --</option>
</select>
</div>