import { Pipe , PipeTransform } from '@angular/core' ; @ Pipe ( { name : 'getById' , pure : false } ) export class GetByIdPipe implements PipeTransform { param { any [ ] } value param { number } id param { string } property returns { any } transform ( value , id , property ) { const foundItem = value . find ( item => { if ( item . id !== undefined ) { return item . id === id ; } return false ; } ) ; if ( foundItem ) { return foundItem [ property ] ; } } }