https://github.com/assisrafael/angular-input-masks
Opinionated input masks for AngularJS
https://github.com/assisrafael/angular-input-masks
Last synced: about 2 months ago
JSON representation
Opinionated input masks for AngularJS
- Host: GitHub
- URL: https://github.com/assisrafael/angular-input-masks
- Owner: assisrafael
- License: mit
- Created: 2014-01-22T02:36:19.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2021-09-15T19:45:09.000Z (almost 4 years ago)
- Last Synced: 2025-04-15T00:46:02.095Z (3 months ago)
- Language: JavaScript
- Homepage: http://assisrafael.github.io/angular-input-masks/
- Size: 716 KB
- Stars: 964
- Watchers: 53
- Forks: 328
- Open Issues: 86
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# angular-input-masks [](https://travis-ci.org/assisrafael/angular-input-masks) [](https://coveralls.io/r/assisrafael/angular-input-masks?branch=master) [](https://github.com/conventional-changelog/standard-version)
[](https://nodei.co/npm/angular-input-masks/)
[](https://gitter.im/assisrafael/angular-input-masks?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://www.bountysource.com/teams/angular-input-masks/bounties?utm_source=angular-input-masks&utm_medium=shield&utm_campaign=bounties_posted)
Opinionated angular input masks. Provides ready to use masks with little (br/inscricao-estadual) to no configuration (number, cnpj, etc).
### Compatibility
- angular-input-masks@~2: angular@^1.3 (however is only tested with lastest 1.x version) and [ECMAScript 5 compliant browsers](http://kangax.github.io/compat-table/es5/) (however CI only tests chrome and firefox).
- angular-input-masks@~1: angular@~1.2## 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:
```
```
Obs: for npm the build scripts are available inside ```releases``` folder.
2. 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
- Number mask Example :
```html
```
- Define the number of decimals (default is 2):
```html
```
### More examples ###
_See more usage examples in the [Demo page](http://assisrafael.github.io/angular-input-masks/)_
## Other build options
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 directives
- ```require('angular-input-masks/br')```: only global and BR directives
- ```require('angular-input-masks/us')```: only global and US directives
- ```require('angular-input-masks/fr')```: only global and FR directives## Filters
Looking for related filters? Take a look at [angular-br-filters](https://github.com/the-darc/angular-br-filters)
## Build
```
npm install
npm run build
```### Tests
- Unit:
- Uses [Karma](http://karma-runner.github.io) + [Jasmine](http://jasmine.github.io/)
- Files: `src/**/*.test.js````
npm run test:unit
```- e2e:
- Uses [Protractor](https://github.com/angular/protractor) + Jasmine
- Files: `src/**/*.spec.js````
npm run test:e2e
```- To run both tests:
```
npm test
```