Im trying to implement search bar using angular (keyup) event.And i have file name like
- base @,
- base $,
- base 1,
- base #,
- base 2,
when i search base @ or base $ or base 1 in the search bar it filters fine. but when i search base # it dont filter base # it filter all file name with base. here is the code below which i have coded
My html:
<input type="search" class="form-control" placeholder="Search file" (keyup)="onSearch($event)" [(ngModel)]='searchKeywords'>
my js code:
onSearch(event: any) {
const keywords = event.target.value;
if (keywords && keywords.length > 2) {
const apiURL =`abc/thg/hjy?filter[file.name]=${keywords}`;
this.api.get(apiURL).subscribe((data: any) => {
console.log(data);
this.topics = data.list;
if (this.trigger) {
this.trigger.openMenu();
}
});
} else {
this.topics = [];
this.trigger.closeMenu();
}
}