This is an input mask implementation for Angular 2 and above. It demonstrates how to use ControlValueAccessor with an attribute directive to mask text in an input field. For this particular example the text is masked to format the input display as decimals using the DecimalPipe but still maintain a numeric/float value in the NgModel.
Here's the code running on stackblitz:
https://angular-u2vcwn.stackblitz.io/
You can fork and make edits here:
Of course you can also clone this project and run or edit it locally as described below.
Clone:
git clone https://github.com/tw3/ngx-currency-input-mask.git
Run ng serve
for a dev server.
Navigate to http://localhost:4200/
The app will automatically reload if you change any of the source files.
- Text Mask (does not automatically unmask the value)
- Autonumeric (not angular-based)
- Inputmask (jQuery-based)
This project was generated with Angular CLI version 1.2.5.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.