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