问题描述
我有一个对象contentType
export interface ContentType {
code: string;
label: string;
}
我想选择此对象作为mat-select的值,它是表单内的一个表单组,绑定不起作用。 如果将formControl = contentType放进去,我会出错,因为这不是一个formControl是一个formGroup。
this.formGroup = this.formGroup.group({
contentType: this.formGroup.group(),});
<div form="formGroup">
<mat-form-field>
<mat-select [formGroupName]="'contentType'">
<mat-option [(value)]="contentType" *ngFor="let contentType of contentTypes$ | async">
{{contentType.label}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
谢谢,我该怎么做才能很好地绑定contentType。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)