src/app/modules/shared/components/material-auto-complete/auto-complete-pipe.ts
Name | autocomplete |
transform | |||||||||
transform(dropdownList: any[], filterObj: literal type)
|
|||||||||
Parameters :
Returns :
any
|
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'autocomplete'
})
export class AutocompletePipe implements PipeTransform {
transform(dropdownList: any[], filterObj: {}): any {
if (dropdownList.length > 0 && filterObj) {
const searchKey = filterObj['filterKey'].toLowerCase();
return dropdownList.filter(x => {
const returnVal = x.toLowerCase().includes(searchKey);
return returnVal;
});
}
return dropdownList;
}
}