import { Pipe , PipeTransform } from '@angular/core' ; import { Color } from '../models/color' ; @ Pipe ( { name : 'colorFilter' } ) export class ColorFilterPipe implements PipeTransform { transform ( value , filterText ) { filterText = filterText ? filterText . toLocaleLowerCase ( ) : "" ; return filterText ? value . filter ( ( p ) => p . name . toLocaleLowerCase ( ) . indexOf ( filterText ) !== - 1 ) : value ; } }