-1

Prime NG 多选初始值看不到选中的复选框

初始化方法

  this.cities =  [
  {label: 'New York', value: 'NY'},
  {label: 'Rome', value: 'RM'},
  {label: 'London', value: 'LDN'},
  {label: 'Istanbul', value: 'IST'},
  {label: 'Paris', value: 'PRS'}];

让 selectedT: Country[];

selectedT = [{标签:“罗马”,价值:“RM”}];

this.dForm.controls["selectedCities"].setValue([{label: "Rome", value: "RM"}]);

4

1 回答 1

0

无需将整个对象传递给“selectedCities”数组。将唯一的值传递给数组。

selectedT = ["RM"];

this.dForm.controls["selectedCities"].setValue(["RM"]);
于 2019-03-23T04:17:59.897 回答