我有我的选择一个选项,以过滤我所有的结果和其他选项列表,我可以从我的列表中设置默认选项,但不能设置第一垫选项为默认值。我怎样才能做到这一点?
<mat-form-field class="col-md-12 p-0 pb-2">
<mat-select formControlName="carControl">
<mat-option value="0">(All)</mat-option>
<mat-option *ngFor="let item of data.filteredListOfCars" [value]="item" ngDefaultControl>
{{this.codeListService.getNameOfManufacturerById(item.manufacturerId)}} {{item.model}} {{item.ecv}}
</mat-option>
</mat-select>
</mat-form-field>
我设置这样的默认值
selectValueInControl(){
this.filterFormGroup.get('statusControl').setValue(0);
}
使用[value]="0"
代替value="0"
的
<mat-option [value]="0">(All)</mat-option>