import { Injectable , Pipe , PipeTransform } from '@angular/core' ; @ Pipe ( { name : 'filter' } ) @ Injectable ( ) export class FilterPipe implements PipeTransform { transform ( items , field , value ) { if ( ! items ) { return [ ] ; } if ( ! field || ! value ) { return items ; } return items . filter ( singleItem => singleItem [ field ] . toLowerCase ( ) . includes ( value . toLowerCase ( ) ) ) ; } }