Set Default Option of md-select
This is about setting an option of md-select when ng-model is an object.
If ng-model is a simple primitive data type, Angular Material selects and highlight the value. But when ng-model is an object, the object is not selected nor highlighted.
This Github issue represents what I want to achieve, but the code pen in the link does not let you change the option. So this is how your html should look like.
<md-select ng-model="ctrl.number">
<md-select-label>{{ ctrl.number.value }}</md-select-label>
<md-option ng-repeat="n in ctrl.numbers" ng-value="n" selected="{{ n.value === ctrl.number.value ? 'selected' : '' }}">{{ n.value }}</md-option>
</md-select>
For forks who are interested in the entire code, I embedded the codepen here. Feel free to play around.
See the Pen Set Default option for md-select by Kohei Arai (@1kohei1) on CodePen.