Answer the question
In order to leave comments, you need to log in
Angular PrimeNG multiselect: how to programmatically select only part of the options from a list?
I have a PrimeNG multiselect, I get the options data for it from the server during initialization, the problem is that all list items are automatically selected, and I only need to select some items with certain IDs. I found a post on the Internet that you can add list items that should be selected using [(ngModel)] pushing them to the appropriate array, but my implementation does not work:
<p-multiSelect [options]="locations" [(ngModel)]="selectedItems"
[formControlName]="'locations'"
[maxSelectedLabels]="1"
defaultLabel="Select office"
optionLabel="address"
dataKey="id"
[filter]="true"></p-multiSelect>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question