Skip to content

Instantly share code, notes, and snippets.

@walidum
Last active April 25, 2021 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walidum/562756a8a7866d9b5dee24ef18ef1bc9 to your computer and use it in GitHub Desktop.
Save walidum/562756a8a7866d9b5dee24ef18ef1bc9 to your computer and use it in GitHub Desktop.
exemple of pipe for Countries abbreviations
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