Opinionated angular input masks. Provides ready to use masks with little (br/inscricao-estadual) to no configuration (number, cnpj, etc).
- angular-input-masks@~2: angular@^1.3 (however is only tested with lastest 1.x version) and ECMAScript 5 compliant browsers (however CI only tests chrome and firefox).
- angular-input-masks@~1: angular@~1.2
npm install --save angular-input-masks
- 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.
- Include the module name
ui.utils.masks
in your angular app. For example:
angular.module('app', ['ui.utils.masks']);
angular.module('demo', [require('angular-input-masks')]);
Some masks are internationalized, so you need to include the proper angular-locale in your app(see: https://docs.angularjs.org/guide/i18n).
- Number mask Example :
<input type="text" name="field" ng-model="number" ui-number-mask>
- Define the number of decimals (default is 2):
<input type="text" name="field" ng-model="number" ui-number-mask="3">
See more usage examples in the Demo page
If you are using npm (without browserify):
- angular-input-masks-dependencies.js: provides all external dependencies (string-mask, br-validations, momentjs)
- angular-input-masks-br.js: provides only global and BR directives, and does not include external dependencies (string-mask, br-validations, momentjs)
- angular-input-masks-us.js: provides only global and US directives, and does not include external dependencies (string-mask, br-validations, momentjs)
- angular-input-masks-fr.js: provides only global and FR directives, and does not include external dependencies (string-mask, br-validations, momentjs)
- angular-input-masks.js: provides all directives, and does not include external dependencies (string-mask, br-validations, momentjs)
If you are using npm with browserify:
require('angular-input-masks')
: provides all directivesrequire('angular-input-masks/br')
: only global and BR directivesrequire('angular-input-masks/us')
: only global and US directivesrequire('angular-input-masks/fr')
: only global and FR directives
Looking for related filters? Take a look at angular-br-filters
npm install
npm run build
npm run test:unit
- e2e:
- Uses Protractor + Jasmine
- Files:
src/**/*.spec.js
npm run test:e2e
- To run both tests:
npm test