ngx-mask
ngx-mask copied to clipboard
Different form control value (regarding inclusion of prefix) when 'dropSpecialCharacters' is on/off
Version: ^13.1.1 + Angular
If I have
mask = "B*"
prefix = "foo/"
patterns= { 'B': { pattern: new RegExp('.') } }
And I have some input where I type bar
When input looks like this (without dropSpecialCharacters)
<input [mask]="mask" [prefix]="prefix" [patterns]="patterns">
Then form value associated with this input is bar (prefix IS NOT included)
When I add dropSpecialCharacters
<input [mask]="mask" [prefix]="prefix" [patterns]="patterns" [dropSpecialCharacters]="false">
Then form value associated with this input is foo/bar (prefix IS included)
This also means that validation of this input differs (e.g. if field is required and I don't type anything, in the first case it is considered as empty (which is what I want) and in the second case form has the same value as prefix so it's not empty)
validation check is wrong when dropSpecialCharacters : false is used, it includes the prefix in the checking of the mask.
please if there's any news let us know
@Nabeeh-AlSawaf @i-knezevic-milan Thanks for your using Ngx-Mask. Please update to latest version. It example, all work as expected - https://stackblitz.com/edit/angular-6e7nns?file=src%2Fmain.ts