Created
August 12, 2021 17:04
-
-
Save wilsaantos/73b38d345ab0d145025addf0e74a01ce to your computer and use it in GitHub Desktop.
Angular Pipe Celular Brasileiro (9 números)
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: 'celular' }) | |
export class CelularPipe implements PipeTransform { | |
transform(value) { | |
if (value != null) { | |
var cell = value.substring(0,0)+'('+value.substring(0,2)+') '+value.substring(2,7)+'-'+value.substring(7); | |
return cell; | |
} else { | |
return value; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment