-1

Prime NG multi select init value cannot see check box selected

init method

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

let selectedT: Country[];

selectedT = [{label: "Rome", value: "RM"}];

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

SSSS
  • 205
  • 2
  • 8
  • 18

1 Answers1

0

No need to pass the whole object to "selectedCities" Array. Pass the only value to an array.

selectedT = ["RM"];

this.dForm.controls["selectedCities"].setValue(["RM"]);
Zarna Borda
  • 695
  • 1
  • 6
  • 22