Lakmi
Lakmi

Reputation: 1389

How to set default value in md-select

This is my angular code I want to set default value as 300mb

<label >RAM</label>
  <md-select ng-model="RAMVal">
    <md-option value="300mb" ng-selected="index == 1">300mb</md-option>
    <md-option value="400mb">400mb</md-option>
  </md-select>

Upvotes: 8

Views: 28279

Answers (2)

Sud
Sud

Reputation: 87

Just set ngModel(RAMVal) value to whichever option you want to be selected by default. ex : $scope.RAMVal = '300mb'; Reference Link : mdSelect

Upvotes: 0

Levent Saatci
Levent Saatci

Reputation: 414

Just add this

 ng-selected="true"

you can check in https://jsfiddle.net/rschmukler/0ju750xo/

Upvotes: 17

Related Questions