JsDaddy / ngx-mask

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

writeValue stops to update Input when input is undefined #1242

Closed luizluan closed 1 year ago

luizluan commented 1 year ago

🐞 bug report

Is this a regression?

Yes, the previous version in which this bug was not present was: I believe is under 14 ### Description The start value from input must be undefined The textfield can or not have mask ## 🔬 Minimal Reproduction Just install de library add [mask] and [patterns] atribute and set [(ngModel)] as undefined

🔥 Exception or Error

image

I believe that the routine must write empty if the input is undefined. What happens is that I fill in the ngModel using an external script, or by actually filling in the input, and after changing pages the input returns to being undefined and the old value remains in the input.

🌍 Your Environment

Angular Version: 16

luizluan commented 1 year ago

The mask also has to be undefined.

luizluan commented 1 year ago

It seems that the value is stored by the service, is there any command to clear the ngx-mask service?

andriikamaldinov1 commented 1 year ago

@luizluan Hi. Could you provide stackblitz ??

luizluan commented 1 year ago

@luizluan Hi. Could you provide stackblitz ??

Sure https://stackblitz.com/edit/stackblitz-starters-mc5b3i

andriikamaldinov1 commented 1 year ago

@luizluan Thanks for using Ngx-Mask. Please update to latest version. It example, all work as expected - https://stackblitz.com/edit/stackblitz-starters-9jfkan?file=src%2Fmain.ts