1
我有一個選擇組件是這樣的:angular2選擇禁用第一要素
<select name="typeSelection" materialize="material_select"
[(ngModel)]="trainingplan.type" >
<option [ngValue] = "null" disabled selected>Please choose a type</option>
<option [ngValue]="type" *ngFor="let type of firebaseService.trainingTypes">
{{type.name}}
</option>
</select>
我想第一個選項被禁用,因此用戶可以看到這個提示。但是取而代之的是,「訓練類型」的第一個條目被選中。我想這是因爲Angular可能不知道要選擇哪一個,因此它需要第一個。我能做些什麼呢?