Last active
April 25, 2021 18:26
-
-
Save walidum/562756a8a7866d9b5dee24ef18ef1bc9 to your computer and use it in GitHub Desktop.
exemple of pipe for Countries abbreviations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Pipe, PipeTransform } from '@angular/core'; | |
@Pipe({ | |
name: 'country' | |
}) | |
export class CountryPipe implements PipeTransform { | |
transform(value: any, args?: any): any { | |
switch (value) { | |
case 'dz' : return ' Algeria'; | |
case 'be' : return ' Belgium'; | |
case 'tn' : return ' Tunisia'; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment