Skip to content

The easiest and funniest way to validate Brazilian documents.

License

Notifications You must be signed in to change notification settings

diegoraguiar/ngx-brazilian-helpers

Repository files navigation

ngx-brazilian-helpers

npm version Build Status Coverage Status Lines of Code Bugs Vulnerabilities

Table of Contents

  1. Getting Started
  2. Usage

Getting Started

ngx-brazilian-helpers is the easiest way to validate brazilian documents in angular forms. Following the available validators:

  1. CPF
  2. CNPJ
  3. NIT (PIS/PASEP)
  4. Renavam
  5. Titulo de Eleitor
  6. Inscrição Estadual
  7. CNS (Carteira Nacional de Saúde)

Usage

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>