JsDaddy / ngx-mask

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

Cannot use allowNegativeNumbers with specialCharacters #1278

Closed lucasousi closed 11 months ago

lucasousi commented 12 months ago

🐞 bug report

Is this a regression?

No

Description

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 allowNegativeNumbers if statement.

image

πŸ”¬ Minimal Reproduction

https://stackblitz.com/edit/ngx-mask-special-characteres-allow-negative-numbers?file=src%2Fmain.ts

🌍 Your Environment

Angular Version:


16.2.12

Anything else relevant?

andriikamaldinov1 commented 11 months ago

@lucasousi Thanks for using Ngx-mask. Please update to latest version. It example all work as expected - https://stackblitz.com/edit/ngx-mask-special-characteres-allow-negative-numbe-krjdnd?file=src%2Fmain.ts