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

Percent pipe should allow negative percentages starting with 0 and support to start with '-' character #1292

Closed durmuse closed 6 months ago

durmuse commented 9 months ago

Hi,

I have run into the following issues while using 'percent.2' pipe with negative numbers: 1) Negative number sign(-) can only be applied after the number is typed, So I end up having to go back to the first character to place the negative sign. The mask should allow us to start typing with "-" character also. 2) Currently mask only allows numbers equal to or greater than 1 to be negative. I'd like to have negative percentages starting with 0 also (-0.12%, -0.25%, etc.)

Thanks.

tkutcher commented 8 months ago

Not sure if related, but seems allowNegativeNumbers is not behaving as anticipated in general. The demos/examples at https://jsdaddy.github.io/ngx-mask/#11 do not appear to be functioning as expected.

joshuaGnol commented 7 months ago

@durmuse try add prefix="-" to input

durmuse commented 7 months ago

@joshuaGnol : In my case user can enter both positive and negative numbers so I should not use a prefix.

andriikamaldinov1 commented 6 months ago

@durmuse @tkutcher @joshuaGnol Thanks for using Ngx-mask. Please update to latest version. It example all work as expected - https://stackblitz.com/edit/stackblitz-starters-cvpjyk?file=src%2Fmain.ts

durmuse commented 6 months ago

I can start with - now for positive numbers, but I still can't type in any negative input starting with 0 (-0.12, -0.25 etc)

On Mon, Mar 25, 2024 at 6:51 AM Andrii Kamaldinov @.***> wrote:

@durmuse https://github.com/durmuse @tkutcher https://github.com/tkutcher @joshuaGnol https://github.com/joshuaGnol Thanks for using Ngx-mask. Please update to latest version. It example all work as expected - https://stackblitz.com/edit/stackblitz-starters-8ebtka?file=src%2Fmain.ts

— Reply to this email directly, view it on GitHub https://github.com/JsDaddy/ngx-mask/issues/1292#issuecomment-2017717998, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJZYNCLNUR4T6E6DM2CRO3YZ76SFAVCNFSM6AAAAABAZS35XSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJXG4YTOOJZHA . You are receiving this because you were mentioned.Message ID: @.***>

andriikamaldinov1 commented 6 months ago

@durmuse Please update to latest version. It example - https://stackblitz.com/edit/stackblitz-starters-temmpb?file=src%2Fmain.ts