assisrafael / angular-input-masks

Opinionated input masks for AngularJS
http://assisrafael.github.io/angular-input-masks/
MIT License
963 stars 329 forks source link

angular-input-masks Build Status Coverage Status Standard Version

NPM

Join the chat at https://gitter.im/assisrafael/angular-input-masks Bountysource

Opinionated angular input masks. Provides ready to use masks with little (br/inscricao-estadual) to no configuration (number, cnpj, etc).

Compatibility

Installation

npm install --save angular-input-masks

Configuration

Without browserify:

  1. Import the angular-input-masks-standalone.min.js script in your page. For example:
<script src="https://github.com/assisrafael/angular-input-masks/raw/master/angular-input-masks-standalone.min.js"></script>

Obs: for npm the build scripts are available inside releases folder.

  1. Include the module name ui.utils.masks in your angular app. For example:
angular.module('app', ['ui.utils.masks']);

With browserify:

angular.module('demo', [require('angular-input-masks')]);

Internationalization

Some masks are internationalized, so you need to include the proper angular-locale in your app(see: https://docs.angularjs.org/guide/i18n).

How to use

<input type="text" name="field" ng-model="number" ui-number-mask>
<input type="text" name="field" ng-model="number" ui-number-mask="3">

More examples

See more usage examples in the Demo page

Other build options

If you are using npm (without browserify):

If you are using npm with browserify:

Filters

Looking for related filters? Take a look at angular-br-filters

Build

npm install
npm run build

Tests

npm run test:unit
npm run test:e2e
npm test