[select] Default value not working
Bug, feature request, or proposal:
my-comp.html
<md-select placeholder="State" [(ngModel)]="myState">
<md-option *ngFor="let state of states" [value]="state.code">{{ state.name }}</md-option>
</md-select>
my-comp.ts
class MyComp {
myState = 'AL';
states = [{code: 'AL', name: 'Alabama'}];
}
What is the current behavior?
No item selected.
Can you replicate the issue with a Plunker? Use the template here.
@willshowell http://plnkr.co/edit/a3KtobwPGzHY4QJPDkMB?p=preview
@jlno in order to use [(ngModel)], you need to import the FormsModule into your NgModule. It looks like you instead used CUSTOM_ELEMENTS_SCHEMA to get rid of the error, and that isn't the right approach.
http://plnkr.co/edit/xNKeDyZFpyJbNkA34cAq?p=preview
@willshowell tnx!
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.