当我*ngIf
在内部设置条件时出现此错误<mat-select>
。
<mat-form-field appearance="legacy">
<mat-label>LOCATION</mat-label>
<mat-select *ngIf="exampleObject.innerObject" [(value)]="exampleObject.innerObject.id">
<ng-container *ngFor="let innerObject of arrays">
<mat-option [value]="innerObject.id">{{innerObject.location}}</mat-option>
</ng-container>
</mat-select>
</mat-form-field>
我的问题是当对象 id 为空时,它在数据库中不存在。我想在下拉列表中显示一个空字段,但它在这一行崩溃了[(value)]="voipDc.hepic.id"
。