Skip to content

Demonstration of an input mask directive for Angular 2 and above, uses ControlValueAccessor and DecimalPipe

Notifications You must be signed in to change notification settings

GistCode/ngx-currency-input-mask

 
 

Repository files navigation

NgxCurrencyInputMask

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:

https://stackblitz.com/edit/angular-u2vcwn?file=app%2Fcurrency-input-mask%2Fcurrency-input-mask.directive.ts

Of course you can also clone this project and run or edit it locally as described below.

Development server

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.

Related projects

Further help

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.

About

Demonstration of an input mask directive for Angular 2 and above, uses ControlValueAccessor and DecimalPipe

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 80.8%
  • JavaScript 10.1%
  • HTML 8.3%
  • CSS 0.8%