dimedrol90
dimedrol90

Reputation: 276

select with angular2 in firefox 44

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

Answers (1)

Amir
Amir

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

Related Questions