JsDaddy / ngx-mask

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

[allowNegativeNumbers] can only be changed with [mask] #1261

Closed ischerf-buhl closed 10 months ago

ischerf-buhl commented 11 months ago

🐞 bug report

Description

This is more a question about intention rather than a bug.

When the value for allowNegativeNumbers is changed after initialization it will only be taken into consideration if at the same time the value for mask is changed.

We have quite often the case that we would still want to have the same mask - as it it about a money value - but want to change whether or not a negative amount can be entered. I guess with the current version this can only be achieved by setting the mask to something else and then change it back.

Is there a reason for this behaviour? Or a better way to 'just' change allowNegativeNumbers?

πŸ”¬ Minimal Reproduction

https://stackblitz.com/edit/stackblitz-starters-kv9ass?file=src%2Fmain.ts

If you comment in line 28 it will work though as this changes both values at the same time.

πŸ”₯ Exception or Error

My expectation would be that I can set the properties separately.

🌍 Your Environment

ngx-mask 16.3.0 (our project) / 16.3.9 (stackblitz)

andriikamaldinov1 commented 10 months ago

@ischerf-buhl Thanks for using Ngx-Mask. Please update to latest version. It example all work as expected - https://stackblitz.com/edit/angular-mpb9s6?file=src%2Fmain.ts