Angular2 wählen Sie "Standard" erste option

Wie wähle ich die erste option in einem select-standardmäßig im Winkel 2 den folgenden code nicht zu funktionieren scheint.

<select id="sType" class="form-control" [(ngModel)]="params.searchType"> 
     <option *ngFor="let t of sTypes" [ngValue]="t.value" [attr.selected]="$index == 0 ? true : null">{{t.name}}</option> 
</select>

InformationsquelleAutor lars1595 | 2016-12-13

Schreibe einen Kommentar