有沒有什麼辦法可以在不使用控制器的情況下爲select設置默認值?默認值爲<select>使用ng-input
我試過很多方法。這是最後一個......
<select [(ngModel)]="model.carColour" [ngModelOptions]="{standalone: true}" class="form-control input-sm" ng-init="model.carColour='select'">
<option value="select">Select color</option>
<option></option>
<option *ngFor="let item of carscolours" [value]="item.value"> {{item.text}}</option>
</select>
我需要設置「選擇顏色」爲默認值,並在下拉列表爲空字符串,並從庫項目。
問題仍然存在 – Antatrix