import { Pipe , PipeTransform } from '@angular/core' ; import { Country } from './model/country.model' ; @ Pipe ( { name : 'search' } ) export class SearchPipe implements PipeTransform { transform ( country , searchCriteria ? ) { if ( ! searchCriteria || searchCriteria === '' ) { return true ; } return `${ country . name }+${ country . dialCode }` . toLowerCase ( ) . includes ( searchCriteria . toLowerCase ( ) ) ; } }