I'm using angular2-multiselect-dropdown from: https://www.npmjs.com/package/angular2-multiselect-dropdown in my angular project and this is my code:
html:
<angular2-multiselect [data]="myData" [(ngModel)]="selectedItems"
[settings]="dropdownSettings"
(onSelect)="onItemSelect($event)"
(onDeSelect)="OnItemDeSelect($event)"
(onSelectAll)="onSelectAll($event)"
(onDeSelectAll)="onDeSelectAll($event)" >
</angular2-multiselect>
ts:
// code ...
this.myData = [
{"id":'1',"itemName":"babaki mora"},
{"id":'2',"itemName":"Jhon smith"},
{"id":'3',"itemName":"Alo dalo"}
];
onItemSelect(item: any) {
console.log(item);
console.log(this.selectedItems);
}
OnItemDeSelect(item: any) {
console.log(item);
console.log(this.selectedItems);
}
onSelectAll(items: any) {
console.log(items);
}
onDeSelectAll(items: any) {
console.log(items);
}
onFilterSelectAll(items: any){
alert(items);
}
The component works fine, but my issue is I didn't find how I can get the search term when the user tries to find an element from the list, I want to get the text then make some http calls search the data from the server.
Do you have any idea on how I can catch the search event when the user starts typing the text?