尝试编辑数据表行时无法设置p-autocomplete的FormGroup值

时间:2019-04-19 12:17:32

标签: angular primeng form-control

我有datatable个编辑。当我单击“编辑”按钮时,将弹出一个弹出窗口,其中填充了formcontrol以外的所有p-autocomplete值。

下面是代码。

HTML :(以下html代码用于p-autocomplete(PrimeNG))

[suggestions]="cities" [forceSelection]="true" formControlName="city" field="value" (completeMethod)="selectedcity($event)" [minLength]="3"

脚本:

onRowEdit(c: UserAddr) {

    this.valid = false;
    this.userAddrForm.setValue({
      mgAddrId: c.mgAddrId,
      lineA: c.lineA,
      lineB: c.mdPostalCd.area,
      lineC: c.mdPostalCd.suburb,
      city: c.mdPostalCd.city,
      province: c.province,
      zipcode: c.mdPostalCd.zipCd
    });
    this.index = this.addresses.indexOf(c);
    this.displayDialog = true;
}

谢谢

0 个答案:

没有答案