Personalized and localized input masks for AngularJS
With Bower:
bower install --save angular-input-masks
Import the
masks.min.jsscript in your page.Include the module
ui.utils.masksin your angular app.Include the ui-mask directive in a text field like the examples abouve:
- Example:
<inputtype="text" name="field" ng-model="number" ui-number-mask>- Define the number of decimals (default is 2):
<inputtype="text" name="field" ng-model="number" ui-number-mask="3">- Allow negative numbers using the
ui-negative-numberattribute:
<inputtype="text" name="field" ng-model="number" ui-number-mask="4" ui-negative-number>- Support to the
min,maxandui-hide-group-sepattributes.
<inputtype="text" name="field" ng-model="number" ui-number-maskmin="10.1" max="100.9"><!-- Use 'ui-hide-group-sep' attribute if you don't want show the thousands separators--><inputtype="text" name="field" ng-model="number" ui-number-maskui-hide-group-sep>- Internationalized: Used the decimal separator and the thousands separator defined in the client browser configuration.
- Example:
<inputtype="text" name="field" ng-model="percentage" ui-percentage-mask>- You can set the number of decimals (default is 2):
<inputtype="text" name="field" ng-model="percentage" ui-percentage-mask="4">Support to the
min,maxandui-hide-group-sepattributes.Internationalized: Used the decimal separator and thousands separator defined in the client browser configuration.
- Example:
<inputtype="text" name="field" ng-model="money" ui-money-mask>- Define the number of decimals (default is 2):
<inputtype="text" name="field" ng-model="money" ui-money-mask="3">Support to the
min,maxandui-hide-group-sepattributes.Internationalized: Used the currency symbol, decimal separator and thousands separator defined in the client browser configuration.
<inputtype="text" name="field" ng-model="phoneNumber" ui-br-phone-number><inputtype="text" name="field" ng-model="cep" ui-br-cep-mask>- Example:
<inputtype="text" name="field" ng-model="initializedCpf" ui-br-cpf-mask>- Example:
<inputtype="text" name="field" ng-model="initializedCnpj" ui-br-cnpj-mask>- Example:
<inputtype="text" name="field" ng-model="initializedCpfCnpj1" ui-br-cpfcnpj-mask><selectng-init="ufs=['AC','AL','AM','TO']" ng-model="selectedUF" ng-options="uf for uf in ufs"></select><inputtype="text" name="field19" ng-model="ieField" ui-br-ie-mask='selectedUF'>Support masks for all the 27 brazillian states.
Validations according to the Sintegra especification.
See more usage examples in the Demo page
Looking for related filters? Take a look at angular-br-filters
npm install
gulp build
gulp test:unit
- e2e:
- Uses Protractor + Jasmine
- Files: src/**/*.test.js
gulp test:e2e
- To run both tests:
gulp test