ngx-mask
ngx-mask copied to clipboard
Does not work with Angular 12
🐞 bug report
Is this a regression?
No idea
Description
It simply does not work :-) I tried with this code:
<input name="niss" type="text" formControlName="niss" mask="99.99.99-999.99" [showMaskTyped]="true" />
So nothing very fancy. At first, it seems to be working:

But as soon as I type something:

And at the end, the mask isn't even respected:

I'm surprised that I didn't find any issue relating to that because it simply nullifies the point of this library.
🔬 Minimal Reproduction
<input name="niss" type="text" formControlName="niss" mask="99.99.99-999.99" [showMaskTyped]="true" />
🔥 Exception or Error
None
🌍 Your Environment
Angular Version:
Angular CLI: 12.2.11
Node: 14.16.1
Package Manager: yarn 1.22.4
OS: win32 x64
Angular: 12.2.11
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1202.11
@angular-devkit/build-angular 12.2.11
@angular-devkit/core 12.2.11
@angular-devkit/schematics 12.2.11
@schematics/angular 12.2.11
rxjs 6.6.7
typescript 4.3.5
Same problem using mask to mask a input test as date
<input name="dateOfBirth" type="text" formControlName="dateOfBirth" mask="99-99-9999" [showMaskTyped]="true" />
By looking at the issue in this repository, it's clear that this library is not maintained anymore. I migrated to https://www.npmjs.com/package/@ngneat/input-mask which seems to perfectly fit the need and is actively maintained.
Don't works here as well. I'm using angular 12 and after installing, tons of compile errors appeared in my console. I even bother to ask for help, moving to other component like @ssougnez suggested.
Yes I used the component suggested by @ssougnez For input date mask worked perfectly on Angular 12
@ssougnez @89snake89 Thank you that shown this issues. Please try ngx-mask >= 14.2.2 Short demonstration https://stackblitz.com/edit/angular-material-13-starter-x1xj4z-tbuvib?file=src%2Fapp%2Fapp.component.html,src%2Fapp%2Fapp.module.ts,src%2Fapp%2Fapp.component.ts
@SuperSoldado If you found some issues in your local environment please provide issue by template and also include your dependencies .