0

I am trying to pre-select a value in a dropdown. I retrieve the selected value from DB. I could not pre-select the value as desired. Can you please help me in fixing this ?

HTML

<select class="form-control" ng-model="reportType.consolidationScopeId">
    <option value="">Please select</option>
    <option ng-repeat="consolidationScope in consolidationScopes" value="{{consolidationScope.consolScopeId}}">{{consolidationScope.consolScopeLabel}}</option>
</select>

Controller

$http.get("/mdmservice/services/consolidationScopes")
.success(function(data, status, headers, config) {
    $scope.consolidationScopes = data;
});
Starscream1984
  • 3,072
  • 1
  • 19
  • 27
SGN
  • 341
  • 1
  • 7
  • 23

1 Answers1

0

Here you can see 3 different examples for select tag using AngularJS:

http://plnkr.co/edit/Xc8Qrcr0AN4I2U0chbye?p=preview

Notice that you can use ng-selected or just use ng-model

Ignacio Villaverde
  • 1,264
  • 1
  • 11
  • 15