Reputation: 11
my HTML code for drop down like follow:
<select ng-model="selected_value"
ng-options="(x.version + ' ' + ' : ' + x.status) for x in allData"></select>
my Angular code like follow : data comes from a rest service
$http.get(......).success(function (data, status){
$scope.allData = data;
$scope.selected_value = $scope.allData[0].version + " : " + $scope.allData[0].status;
});
Data comes to the drop down. but initially drop down does not display the value. It shows if only select the value. Can someone help on this issue.
Upvotes: 0
Views: 57
Reputation: 1164
Add ng-selected="selected_value"
to the select
element.
An example of what you are trying to achieve can be found in the ngSelected documentation.
Upvotes: 0