Skip to content

Instantly share code, notes, and snippets.

@wilsaantos
Created August 12, 2021 17:04
Show Gist options
  • Save wilsaantos/73b38d345ab0d145025addf0e74a01ce to your computer and use it in GitHub Desktop.
Save wilsaantos/73b38d345ab0d145025addf0e74a01ce to your computer and use it in GitHub Desktop.
Angular Pipe Celular Brasileiro (9 números)
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