How to select default multiselect primeng values with label display
how to choose default values for multiselect primeng, you need this to update the form
code:
@Component({
template: `<p-multiSelect [options]="cities" [(ngModel)]="selectedCities" ></p-multiSelect>`
})
export class MyComponent {
cities: SelectItem[];
selectedCities= [];
public constructor() {
this.cities = [];
this.cities.push({ label: 'Paris', value:{id:'1',country:'France', name:'paris'} });
this.cities.push({ label: 'Madrid', value:{id:'2',country:'Spain', name:'madrid'} });
this.selectedCities.push({id:'2',country:'Spain', name:'madrid'})
}
current behavior: the values are in the list, but the label got null
+3
source to share