我想将角度2中的选择的默认选项设置为“选择一个选项”。这里是我到目前为止的代码:设置默认的选择列表值Angular2
HTML
<div class="form-group">
<label class="col-md-4 control-label" for="CustomFix">Select an option:</label>
<div class="col-md-4">
<select id="example" name="example" class="form-control" [(ngModel)]="exampleArray" (ngModelChange)="changes()">
<option disabled selected>Select a Custom Fix</option>
<option *ngFor="let example of exampleArray" [ngValue]="example">{{example.attribute }}</option>
</select>
</div>
</div>
打字稿
changes(){
console.log(this.example.option);
}
我在我的HTML行:
<option disabled selected>Select a Custom Fix</option>
如何我可以启用此作为默认t选项?它与我的数组分开使用ngModel
选项如何既残疾人和选择?如果它被禁用,那么根据定义它不能被选择。 –