Reputation: 276
I have next select:
<select id="type"
name="type"
class="b-form__input"
[(ngModel)]="currentDoc.type">
<option *ngFor="let fileType of fileTypes" [ngValue]="fileType">{{ fileType.value }}</option>
</select>
If I just open form with that select and press submit (without select changing) then ngModel will be null although in Firefox 44 or 29 select as value has first option.
How to solve that problem? How to enforce angular to set first option as ngModel value in firefox?
Upvotes: 0
Views: 185
Reputation: 2032
you can set the default value of model:
currentDoc{
type: ".doc"
}
You can check plunker demo here: https://plnkr.co/edit/lGFyPVaIRRXODjdmBD7E?p=preview
Upvotes: 0