【发布时间】:2021-10-08 14:35:09
【问题描述】:
在我的代码中,我有一列,用户可以在其中添加元素并在添加元素时选择其优先级类型。我正在尝试为该下拉列表提供默认值(row.PriorityType.Id ==1)。我试着像下面那样做,但我得到了错误。我可以在我的案例中使用value 属性吗?我应该解决什么问题?
HTML:
<mat-form-field floatLabel="never" *ngIf="EditIndex == i" class="w-100-p">
<mat-select [(ngModel)]="row.PriorityType" name="PriorityType" [(value)]="{row.PriorityType?.Id == 1}">
<mat-option *ngFor="let priority of priorityList" [value]="priority">
{{priority.Name}}
</mat-option>
</mat-select>
</mat-form-field>
【问题讨论】:
标签: javascript html angular typescript angular-material