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

The onChange is triggered when [mask] change even if the triggerOnMaskChange is false. Input becomes dirty when maskChanged. #1360

Open
XHicoRVI opened this issue May 2, 2024 · 0 comments
Labels

Comments

@XHicoRVI
Copy link

XHicoRVI commented May 2, 2024

馃悶 bug report

Is this a regression?

Yes, the previous version in which this bug was not present was: 16.2.4

Description

The onChange is triggered when [mask] updating after init. Input becomes dirty when maskChanged.

馃敩 Minimal Reproduction

https://stackblitz.com/edit/angular-ivy-mask-qy4mdv?file=src%2Fapp%2Fapp.component.html

The problem comes from this behaviour : https://github.com/JsDaddy/ngx-mask/blob/develop/projects/ngx-mask-lib/src/lib/ngx-mask.service.ts#L526

The onChange is triggered when mask changed even if the triggerOnMaskChange is false.

The if (this.writingValue || (!this.triggerOnMaskChange && this.maskChanged)) should never trigger onChange. In the case in latest versions the function always call onChange if this.maskChanged is true.

If this is a wanted behaviour we need a configuration variable to choose if we want the onChange triggered when maskChanged.

馃實 Your Environment

Angular Version:


Angular CLI: 16.2.11
Node: 18.12.1
Package Manager: npm 9.8.1
OS: win32 x64

Angular: 16.2.12
... animations, cdk, common, compiler, compiler-cli, core, forms
... localize, material, material-moment-adapter
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1602.11
@angular-devkit/build-angular   16.2.11
@angular-devkit/core            16.2.11
@angular-devkit/schematics      16.2.11
@angular/cli                    16.2.11
@schematics/angular             16.2.11
ng-packagr                      16.2.3
rxjs                            7.8.1
typescript                      4.9.5
zone.js                         0.13.3
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