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>
Just for information, you need to make sure the datatype of the default value matches with that of the options, for.eg, <mat-select [(value)]="heroes[0]. id"> <mat-option *ngFor="let hero of heroes" [value]="hero.id">{{ hero.name }}</mat-option> </mat-select> will work.
mdSelect API Documentation This behavior can be disabled by using the md-no-asterisk attribute. By default, the select will display with an underline to match other form elements. This can be disabled by applying the md-no-underline CSS class.
Just add this
ng-selected="true"
you can check in https://jsfiddle.net/rschmukler/0ju750xo/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With