Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with updating ngModel value of Angular input and mask #1342

Open
Dastardl opened this issue Apr 2, 2024 · 0 comments
Open

Issue with updating ngModel value of Angular input and mask #1342

Dastardl opened this issue Apr 2, 2024 · 0 comments
Labels

Comments

@Dastardl
Copy link

Dastardl commented Apr 2, 2024

馃悶 bug report

Is this a regression?

No idea, this came up while trying to update our dependency on cleave.js for a mask for a date field. Tested versions are 17.0.6 and 17.0.7 (latest at time of writing).

Description

There is some weird behavior going on when an input field is bound using ngModel and the underlying model is updated in code.

馃敩 Minimal Reproduction

Stackblitz

  1. Type any valid date in the input field (ex. 01/01/1999)
  2. The model is updated to this new value - output in console while typing is as expected.
  3. Click the 'update model' button. This will set the myValue variable to 01/01/2000. The underlying variable is modified as seen next to the 'The model: ' text, but the displayed value in the textbox is not. Neither is the ngModelChanged method called.

-> If the value of the textbox is empty and the button is clicked, both the model and the displayed text in the input are correct.
-> If you typed anything in the textbox before emptying it and clicking the button the behavior is as described above where the input displays the old value.

馃敟 Exception or Error

None

馃實 Your Environment

Angular Version:

Exactly as in the stackblitz example. Angular 17, ngx-mask 17.0.6 and 17.0.7 (both have this issue).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants