Created
November 22, 2019 14:10
-
-
Save carlitomurta/ba9a462d4517220b47e765f685505f06 to your computer and use it in GitHub Desktop.
Pipe Angular para Agência
This file contains hidden or 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: 'agencia' | |
}) | |
export class AgenciaPipe implements PipeTransform { | |
transform(value: string, args?: any): any { | |
if (value) { | |
value = value.replace(/\D/g, ''); | |
if (value.length < 4) { | |
value = value.padStart(4, '0'); | |
} | |
} | |
return value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment