ngx-mask on input rounding off to nearest
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑
I'm using Angular 11 with Material. For a input field to get $ amount upto (15, 2) from user, I'm using the the below code..,
<input matInput type="text"
mask="separator.2" thousandSeparator=","
separatorLimit="100000000000000”
id="membershipStockMinReq" formControlName="membershipStockMinReq" tabindex="17">
I also have same validation in API with 15 digits and 2 decimals. However, when i enter the input as 999999999999999.99, its getting rounded off and passing 1000000000000000 to API which throwing error. Is there any way to restrict the rounding?
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑
Currently using ngx 11.1.5 version.
https://javascript.info/number#imprecise-calculations It's a limitation of JS. I would recommend using a string.
This is a duplication of https://github.com/JsDaddy/ngx-mask/issues/929
https://javascript.info/number#imprecise-calculations It's a limitation of JS. I would recommend using a string.
I dont get you. I'm already using input type as "text".. What else I can do to make it work on the above code?
@Jagan-Rameshbabu Thanks for your using Ngx-Mask. Please update to latest version. It example, all work as expected - https://stackblitz.com/edit/angular-pumvn1?file=src%2Fmain.ts