Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 角度素数Mutliselect下拉列表值在编辑时不绑定?_Angular_Typescript_Api - Fatal编程技术网

Angular 角度素数Mutliselect下拉列表值在编辑时不绑定?

Angular 角度素数Mutliselect下拉列表值在编辑时不绑定?,angular,typescript,api,Angular,Typescript,Api,我正在使用angular和Priming显示多选下拉列表,但在编辑时,我无法看到多选下拉列表上的值,但在下拉列表中无法看到选中的值 但是,当我单击编辑按钮时,下拉值被选中,但该值没有显示在输入字段中,仍然显示为仅选择一个选项 在.html中:- <p-multiSelect [options]="polygons" formControlName="polygon" [(ngModel)]="selectedPolygon

我正在使用angular和Priming显示多选下拉列表,但在编辑时,我无法看到多选下拉列表上的值,但在下拉列表中无法看到选中的值

但是,当我单击编辑按钮时,下拉值被选中,但该值没有显示在输入字段中,仍然显示为仅选择一个选项

在.html中:-

         <p-multiSelect [options]="polygons" formControlName="polygon" [(ngModel)]="selectedPolygons"
                    appRequired placeholder="Select a option"
                    [ngClass]="{ 'is-invalid': submitted && f.polygon.errors?.error }" optionLabel="name"
                    optionValue="code">
     </p-multiSelect>
}

}
}

您能分享所有的组件代码吗?也许API调用应该在ngOnInit()方法中完成
export interface DropdownModel {
name: string;
code: number;
polygons: DropdownModel[];


selectedPolygons: any = [];




ngOnInit() {
getAssignPolygons(workstate: any) {
this.http.get('url', workstate).subscribe((data: any) => {
  if (data.isSuccessful === true) {
    this.selectedPolygons = data.data.polygons;
    }
  }
});