Angular <;的默认值;选择>;使用ng输入

Angular <;的默认值;选择>;使用ng输入,angular,select,default,ng-init,ngmodel,Angular,Select,Default,Ng Init,Ngmodel,在我的情况下,有没有办法在不使用控制器的情况下为select设置默认值 我试过很多方法。这是最后一个 <select [(ngModel)]="model.carColour" [ngModelOptions]="{standalone: true}" class="form-control input-sm" ng-init="model.carColour='select'"> <option value="select">Select color</

在我的情况下,有没有办法在不使用控制器的情况下为select设置默认值

我试过很多方法。这是最后一个

<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>

选择颜色
{{item.text}
我需要设置“选择颜色”为默认值,在下拉列表中将是空字符串和库中的项目

选择颜色
<option selected="selected">Select Color</option>

找到答案。也许有人会需要它

<select [(ngModel)]="model.carColour"  #States="ngModel" name="carColours" class="form-control input-sm" >
       <option [ngValue]="model.carColour" hidden>Please, select...</option>
       <option></option>
       <option *ngFor="let item of carscolours" [ngValue]="item.value" >{{item.text}}</option>
    </select>

请选择。。。
{{item.text}

我不明白这怎么行得通。检查该选项时,该选项上是否没有这些属性?它默认为什么?如果在系统中没有ngModel,它就会工作。我需要什么?视图中的“选择颜色”在组合框中显示为占位符。幸运的是,您的问题以前被问过无数次。见:或。下次尝试搜索!我找了一个小时。看到了所有这些答案。他们没有解决我的问题。我怀疑你当时没有正确地实现解决方案,但是你没有展示任何你实际尝试过的JS代码,所以我们无法告诉你你做错了什么。不幸的是,我不熟悉Angular,但它看起来是您在配置中设置的,但很多答案显示了解决它的许多方法。问题仍然是实际问题我一直在找这个!!