npm-g-cpf-cnpj
AngularJS directive to validate CPF/CNPJ numbers, using cpf_cnpj.js. All credits to André Gil.
How to install
npm install npm-ng-cpf-cnpj --save
And add to your index.html
And inject it to your angular.module
angular.module('myApp', ['ngCpfCnpj']);
How to use
Just add ng-cpf
or ng-cnpj
to any <input/>
. 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 }}