I have encountered an issue with ordering the drop down list alphabetically using Angular.js. Below is the code I am using:
<div class="input-group bmargindiv1 col-md-12">
<span class="input-group-addon ndrftextwidth text-right" style="width:180px">Business Name :</span>
<select class="form-control" id="restau" ng-model="restaurant" ng-options="qua.name for qua in listOfRestaurant | orderBy:'name' track by qua.value" ng-change="getDayFromSpecial('restau');">
</select>
</div>
$scope.listOfRestaurant=[{
name:'Select Business Name',
value:''
}]
$scope.restaurant=$scope.listOfRestaurant[0];
$http({
method:'GET',
url:"php/customerInfo.php?action=restaurant",
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response){
angular.forEach(response.data,function(obj){
var data={'name':obj.rest_name,'value':obj.member_id};
$scope.listOfRestaurant.push(data);
})
},function errorCallback(response) {
})
The problem I am facing is that while I can order the list, the item Select Business Name
is appearing in the middle of the list rather than at the beginning where it should be.