blob: bee24ab116b79b66acb12250fbb57ea082ea4cd5 [file] [log] [blame]
import { Pipe, PipeTransform } from '@angular/core';
import { IDataSchema } from './autocomplete.component';
@Pipe ({
name: 'AutocompletePipe',
})
export class AutocompletePipe implements PipeTransform {
public transform(data: IDataSchema[], text: string) {
if (!text || !text.length) {
return data;
}
return data.filter((item: IDataSchema) => {
return item.value.toLowerCase().indexOf(text.toLowerCase()) > -1;
});
}
}