diff --git a/src/currency-mask.directive.ts b/src/currency-mask.directive.ts index 53dc8e9..fbe286d 100644 --- a/src/currency-mask.directive.ts +++ b/src/currency-mask.directive.ts @@ -119,6 +119,13 @@ export class CurrencyMaskDirective implements AfterViewInit, ControlValueAccesso } } + @HostListener("change", ["$event"]) + handleChange(event: any) { + if (!this.isChromeAndroid()) { + !this.isReadOnly() && this.inputHandler.handleChange(event); + } + } + isChromeAndroid(): boolean { return /chrome/i.test(navigator.userAgent) && /android/i.test(navigator.userAgent); } diff --git a/src/input.handler.ts b/src/input.handler.ts index fbe8a79..44cc22f 100644 --- a/src/input.handler.ts +++ b/src/input.handler.ts @@ -121,6 +121,14 @@ export class InputHandler { }, 1); } + handleChange(event: any): void { + setTimeout(() => { + this.inputService.updateFieldValue(); + this.setValue(this.inputService.value); + this.onModelChange(this.inputService.value); + }, 1); + } + updateOptions(options: any): void { this.inputService.updateOptions(options); }