binding data from API to ng-multi-select dropdown and exclude the selected items - Angular

611 Views Asked by At

I have created multiselect dropdown using ng-multiselect-dropdown with ngModel I wanted to bind data through API and I have to exclude the list of selected items from the dropdown

1

There are 1 best solutions below

0
On

in html:

<ng-multiselect-dropdown #sampleSelect
        [settings]="dropdownSettings"
        [data]="samples"
        [(ngModel)]="selectedSamples">
</ng-multiselect-dropdown>

in typescript:

samples = [];
selectedSamples = [];
dropdownSettings: IDropdownSettings;
@ViewChild('sampleSelect') sampleSelect;

getSamples(): void {
  const data = (data get from sever and changed after recieved)
  this.sampleSelect.data = data;
}