It is not possible to use allowNegativeNumbers equals true together with a custom value to specialCharacters property.
The value is rendered well, but the model value remains positive even for negative values.
I think the problem is in ngOnChanges fn of the ngx-mask.directive.ts file. The if statement for specialCharacters replaces the value of this.specialCharacters that was updated by the allowNegativeNumbersif statement.
π bug report
Is this a regression?
No
Description
It is not possible to use
allowNegativeNumbers
equalstrue
together with a custom value tospecialCharacters
property. The value is rendered well, but the model value remains positive even for negative values.I think the problem is in
ngOnChanges
fn of thengx-mask.directive.ts
file. Theif
statement forspecialCharacters
replaces the value ofthis.specialCharacters
that was updated by theallowNegativeNumbers
if
statement.π¬ Minimal Reproduction
https://stackblitz.com/edit/ngx-mask-special-characteres-allow-negative-numbers?file=src%2Fmain.ts
π Your Environment
Angular Version:
Anything else relevant?