ng-cpf-cnpj
AngularJS directive to validate CPF/CNPJ numbers, using cpf_cnpj.js.
Instalation
npm install ng-cpf-cnpj cpf_cnpj --save
And add to your index.html
And inject it to your angular.module
angular.module('myApp', ['ngCpfCnpj']);
Usage
Just add ng-cpf
or ng-cnpj
to any <input/>
.
myForm.cpf.$valid: {{ myForm.cpf.$valid }} myForm.cnpj.$valid: {{ myForm.cnpj.$valid }}
You can also use ui-mask
, from ui-utils, to restrict the format:
myForm.cpf.$valid: {{ myForm.cpf.$valid }} myForm.cnpj.$valid: {{ myForm.cnpj.$valid }}
Copyright and License
Copyright (c) 2017 Marcel de Oliveira Coelho under the MIT license. Go Crazy. 🚀