问题描述
<mat-select formControlName="x" #xyz>
<mat-option *ngFor="let x of xList" [value]="x">{{ x.name }}</mat-option>
</mat-select>
@H_502_4@
x对象是这样的:
x: {id: string,name: string}
@H_502_4@
我的问题是我使用服务获取所有对象“ x”,然后获取拥有与对象x相等的属性的用户以进行编辑,但选择值未获得用户的值。 x被选中。
在我的.ts文件中是:
formUser = this.formBuilder.group({
id: null,x: {
id: null,name: null
}});
@H_502_4@
在构造函数中:
if (this.router.getCurrentNavigation().extras.state){
this.user = this.router.getCurrentNavigation().extras.state.user;
this.formUser.patchValue(this.user);
}
@H_502_4@
如何解决这个问题?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)