import { Pipe , PipeTransform } from '@angular/core' ; @ Pipe ( { name : 'filter' } ) export class FilterPipe implements PipeTransform { transform ( list , field , keyword ) { if ( field && keyword ) { return list . filter ( item => item [ field ] . indexOf ( keyword ) >= 0 ) ; } else { return list ; } } }