ngx-brazilian-helpers
is the easiest way to validate brazilian documents in angular forms. Following the available validators:
- CPF
- CNPJ
- NIT (PIS/PASEP)
- Renavam
- Titulo de Eleitor
- Inscrição Estadual
- CNS (Carteira Nacional de Saúde)
Install ngx-brazilian-helpers
via npm
:
npm install ngx-brazilian-helpers --save
Import in your app.module.ts
or any module you want to use it:
import { ValidatorsModule } from 'ngx-brazilian-helpers';
@NgModule({
imports: [
ValidatorsModule.forRoot()
]
})
Using it:
<input id="yourId" name="yourName" ngModel cpf>
or
<input [formControl]='yourControl' cpf>
or
<input formControlName='yourControlName' cpf>