An open API service indexing awesome lists of open source software.

https://github.com/flasd/ng-cpf-cnpj

AngularJS directive to validate CPF/CNPJ numbers.
https://github.com/flasd/ng-cpf-cnpj

Last synced: 10 months ago
JSON representation

AngularJS directive to validate CPF/CNPJ numbers.

Awesome Lists containing this project

README

          

# ng-cpf-cnpj

AngularJS directive to validate CPF/CNPJ numbers, using [cpf_cnpj.js](https://github.com/fnando/cpf_cnpj.js).

[![Build Status](https://travis-ci.org/flasd/ng-cpf-cnpj.svg?branch=master)](https://travis-ci.org/flasd/ng-cpf-cnpj)
[![npm version](https://badge.fury.io/js/ng-cpf-cnpj.svg)](https://www.npmjs.com/package/ng-cpf-cnpj)

### Instalation

```npm install ng-cpf-cnpj cpf_cnpj --save```

And add to your index.html

```html

```
And inject it to your angular.module

```angular.module('myApp', ['ngCpfCnpj']); ```

### Usage

Just add ```ng-cpf``` or ```ng-cnpj``` to any ``````.

```html


myForm.cpf.$valid: {{ myForm.cpf.$valid }}


myForm.cnpj.$valid: {{ myForm.cnpj.$valid }}

```

You can also use ```ui-mask```, from [ui-utils](https://github.com/angular-ui/ui-utils), to restrict the format:

```html



myForm.cpf.$valid: {{ myForm.cpf.$valid }}


myForm.cnpj.$valid: {{ myForm.cnpj.$valid }}

```

### Copyright and License

Copyright (c) 2017 [Marcel de Oliveira Coelho](https://github.com/flasd) under the [MIT license](https://github.com/flasd/ng-cpf-cnpj/blob/master/LICENSE). Go Crazy. :rocket: