Since you are using parameters, you should use this ng2-select . In this case, you should bind it to ngModel , and then update this value when initializing your script:
those. HTML
<ng-select [multiple]="true" [options]="myOptions" [(ngModel)]="mySelectValue"> </ng-select>
TS
export class App implements OnInit { myOptions: Array<any>; mySelectValue: Array<string>; // Array of strings for multi select, string for single select. ngOnInit() { this.myOptions = [ {value: 'a', label: 'Alpha'}, {value: 'b', label: 'Beta'}, {value: 'c', label: 'Gamma'}, ]; this.mySelectValue = ['b', 'c']; } }
source share