JsDaddy / ngx-mask

Angular Plugin to make masks on form fields and html elements.
https://jsdaddy.github.io/ngx-mask
MIT License
1.16k stars 300 forks source link

ngx-mask 16.1.9 introduces issue with numbers #1222

Closed johnjardinemd closed 1 year ago

johnjardinemd commented 1 year ago

🐞 bug report

Is this a regression?

Yes

Description

Version 16.1.9 introduces an issue when the mask is "0*.00" and something updates the numeric model to a new value. This causes an error.

πŸ”¬ Minimal Reproduction

https://stackblitz.com/edit/angular-zayayn?file=src%2Fmain.ts

πŸ”₯ Exception or Error

Console error:

ERROR Error: Uncaught (in promise): TypeError: value.includes is not a function
TypeError: value.includes is not a function
    at NgxMaskDirective.validate (ngx-mask.mjs:1453:31)
    at forms.mjs:807:31
    at forms.mjs:790:40
    at Array.map (<anonymous>)
    at executeValidators (forms.mjs:790:23)
    at forms.mjs:821:28
    at forms.mjs:790:40
    at Array.map (<anonymous>)
    at executeValidators (forms.mjs:790:23)
    at FormControl._composedValidatorFn (forms.mjs:821:28)
    at resolvePromise (zone.js:1193:31)
    at zone.js:1264:17
    at _ZoneDelegate.invokeTask (zone.js:402:31)
    at Object.onInvokeTask (core.mjs:27437:33)
    at _ZoneDelegate.invokeTask (zone.js:401:60)
    at Zone.runTask (zone.js:173:47)
    at drainMicroTaskQueue (zone.js:581:35)
    at ZoneTask.invokeTask [as invoke] (zone.js:487:21)
    at invokeTask (zone.js:1631:18)
    at globalCallback (zone.js:1674:33)

🌍 Your Environment

Angular 16, latest (16.2.4)

Anything else relevant?

Rolling back to ngx-mask 16.1.8 resolves my issue. It seems to have been introduced in 16.1.9.

andriikamaldinov1 commented 1 year ago

@johnjardinemd Thanks for using Ngx-Mask. Please update to latest version. It example - https://stackblitz.com/edit/angular-eraw2p?file=src%2Fmain.ts

johnjardinemd commented 1 year ago

I can confirm the issue is resolved in 16.3.3. That was fast. Thank you!