angular-input-masks Build Status Coverage Status

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

With Bower:

bower install --save angular-input-masks

With npm:

npm install --save angular-input-masks

Configuration

With bower or npm (without browserify):

  1. Import the angular-input-masks-standalone.min.js script in your page. For example:
<script src="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 npm and 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

ui-number-mask

<input type="text" name="field" ng-model="number" ui-number-mask>
<input type="text" name="field" ng-model="number" ui-number-mask="3">
<input type="text" name="field" ng-model="number" ui-number-mask="4" ui-negative-number>
<input type="text" name="field" ng-model="number" ui-number-mask min="10.1" max="100.9">
<!-- Use 'ui-hide-group-sep' attribute if you don't want show the thousands separators-->
<input type="text" name="field" ng-model="number" ui-number-mask ui-hide-group-sep>

ui-percentage-mask

<input type="text" name="field" ng-model="percentage" ui-percentage-mask>
<input type="text" name="field" ng-model="percentage" ui-percentage-mask="4">
<input type="text" name="field" ng-model="percentage" ui-percentage-mask ui-percentage-value>

ui-money-mask

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

ui-br-phone-number

<input type="text" name="field" ng-model="phoneNumber" ui-br-phone-number>

ui-br-cep-mask

<input type="text" name="field" ng-model="cep" ui-br-cep-mask>

ui-br-cpf-mask

<input type="text" name="field" ng-model="initializedCpf" ui-br-cpf-mask>

ui-br-cnpj-mask

<input type="text" name="field" ng-model="initializedCnpj" ui-br-cnpj-mask>

ui-br-cpfcnpj-mask

<input type="text" name="field" ng-model="initializedCpfCnpj1" ui-br-cpfcnpj-mask>

ui-br-ie-mask

<select ng-init="ufs=['AC','AL','AM','TO']" ng-model="selectedUF" ng-options="uf for uf in ufs"></select>
<input type="text" name="field19" ng-model="ieField" ui-br-ie-mask='selectedUF'>

ui-time-mask

-Example:

<input type="text" name="field" ng-model="initializeTime" ui-time-mask>

See more usage examples in the Demo page

Masks without documentation (help wanted!)

Another build options

If you are using bower or 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
gulp build

Tests

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