import { Pipe , PipeTransform } from '@angular/core' ; @ Pipe ( { name : 'city' , pure : true } ) export class CityPipe implements PipeTransform { transform ( value , ... args ) { let fmt = args [ 0 ] ; let short , long ; switch ( value ) { case 'Graz' : long = 'Flughafen Graz Thalerhof' ; short = 'GRZ' ; break ; case 'Hamburg' : long = 'Airport Hamburg Fuhlsbüttl Helmut Schmidt' ; short = 'HAM' ; break ; default : long = short = 'ROM' ; } if ( fmt === 'short' ) return short ; return long ; } }