Closed klipnot closed 1 year ago
Can anyone has any idea please ? 🤔
@varadero Thanks for using Ngx-Mask. Please update to latest version. It example all work as expected - https://stackblitz.com/edit/angular-vwdi3b?file=src%2Fmain.ts
@andriikamaldinov1 So what you propose me is to update to the next version of Angular ?
Unfortunately I can't upgrade to Angular 16 for now I was already updating from 14 to 15.
If anyone has this issue and same constraint (unable to migrate to Angular 16)
Following what I found in this issue I've implemented a new wrapper pipe.
"ngx-mask": "15.2.1",
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, FormsModule],
providers: [
provideNgxMask(),
],
bootstrap: [AppComponent],
})
export class AppModule {}
import { Pipe, PipeTransform } from '@angular/core';
import { NgxMaskService } from 'ngx-mask';
/*
* I have to create this mask in order to workaround this Issue https://github.com/JsDaddy/ngx-mask/issues/1258
* Where `null` values are masked by ngx-mask when used on template ref
*
* */
@Pipe({
name: 'maskA15WorkAroundWrapper',
})
export class MaskWrapperPipe implements PipeTransform {
constructor(private maskService: NgxMaskService) {}
transform(value: string | number, mask: string): string {
return this.maskService.applyMask(value?.toString(), mask);
}
}
🐞 bug report
Is this a regression?
Probably yes, the previous version in which this bug was not present was: 14.2.4
Description
When using
mask
directive in ang-template
withngTemplateOutletContext
value that can be set tonull
orundefined
was skipped by themask
directive nothing happened and no errors was triggered which was "good"Now the value is treated as a string type value, the mask is applied on
null
string.🔬 Minimal Reproduction
14.2.4 Version in this stackblitz
15.2.1 Version in this stackblitz
🔥 Exception or Error
No errors throw, just a different behavior.
🌍 Your Environment
Angular Version: Before
Now
Anything else relevant?
I firstly supposed that values given through
ngTemplateOutletContext
as been converted tostring
value but it seems to not be the case.