Reputation: 1521
I am using reactive forms with prime ng multi select. When I try to patchValue with the desired default value that is received from the service, it populates and check the checkboxes correctly, however the chips are not populated and the chips are not set. How can I see the chips also in the multiselect? I have tried to do this:
<p-multiSelect
[options]="this.muscles"
[showToggleAll]="false"
formControlName="muscles"
defaultLabel="Select Muscles"
optionLabel="name"
display="chip"
></p-multiSelect>
this.exerciseForm.patchValue(
{
muscles: this.muscleService.getExerciseMusclesNames(
this.config.data.exerciseToEdit
),
},
{ emitEvent: true }
);
Upvotes: 0
Views: 2741
Reputation: 508
Check this sample StackBlitz for setting patchValue and defaultValue with p-multiSelect and reactive form.
Upvotes: 1