JsDaddy / ngx-mask

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

dynamically [mask] removes Special Characters even if [dropSpecialCharacters] ="false" #1345

Open HenriqueCTMM opened 2 months ago

HenriqueCTMM commented 2 months ago

🐞 bug report

Is this a regression?

It worked on version 7.9.10 (when i was using Angular 14) I'm not exactly sure which version the bug started occurring.

Description

The problem arises when dynamically updating the mask directive. The [dropSpecialCharacters] functionality ceases to work upon mask changes, causing the value to lose its special characters. For instance, before the change, the value appears as '12 3456-78901', but after the mask change, it becomes '12345678901'. While the stackblitz application generates an error, my application does not display that error message. However, the bug persists.

πŸ”¬ Minimal Reproduction

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

πŸ”₯ Exception or Error


"Error: NG0100: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '00 00000-00009'. Current value: '00 0000-00009'. Expression location: DoNotDropSpecialCharacters component."

🌍 Your Environment

*NGX-mask version: ^17.0.7 Angular & NGX-mask Version:**


@angular-devkit/architect          0.1702.1
@angular-devkit/build-angular      17.2.1
@angular-devkit/core               17.2.1
@angular-devkit/schematics         17.2.1
@angular/cdk                       17.2.1
@angular/cli                       17.2.1
@angular/material                  17.2.1
@angular/material-moment-adapter   17.2.1
@schematics/angular                17.2.1
rxjs                               6.6.7
typescript                         5.3.3
zone.js                            0.14.4
ngx-mask                            17.0.7