【发布时间】:2021-02-22 21:18:10
【问题描述】:
我正在努力将组合值输入到选择中。假设我们的对象只包含一个 ID 和一个 name,通常的选择方法是:
<mat-form-field>
<mat-label>Placeholder</mat-label>
<mat-select>
<mat-option *ngFor="let i of fooCollection" [value]="i.id">
{{i.name}}
</mat-option>
</mat-select>
</mat-form-field>
现在要输入一个值,我发现 this working example in the documentation 只是在 mat-select 标记中添加了一个 [(value)] 选项,但是由于我们在这里得到了一个组合对象,所以它不再起作用了。
关于如何解决这个问题的任何想法?非常感谢 ! 凯夫'
【问题讨论】:
标签: angular typescript drop-down-menu angular-material angular11