Created
April 3, 2019 20:17
-
-
Save argentinaluiz/754c838c76891f8de449c16ae79859b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as $ from 'jquery'; | |
| import 'jquery-mask-plugin/dist/jquery.mask'; | |
| import {Directive, ElementRef} from '@angular/core'; | |
| @Directive({ | |
| selector: '[appMaskNumber]' | |
| }) | |
| export class MaskNumberDirective { | |
| constructor(private elementRef: ElementRef) { | |
| this.applyMask(); | |
| } | |
| applyMask(){ | |
| const nativeElement = this.elementRef.nativeElement; //DOM | |
| $(nativeElement).find('input').mask('#.##0,00', {reverse: true}); //ion-input ->input | |
| } | |
| } | |
| <ion-input appMaskNumber> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment