ngx-mask
ngx-mask copied to clipboard
comma_seperator.2 problem
[x] Bug ngx-mask v8.0.9 Angular v7.2.0
I am having problem with comma_seperator.2. It doesn't add following 0 to the 1 digit decimal to make it 2 decimal. Input: 1000.1 it render as 1,000.1 It doesn't render as 1,000.10
thanks.
Are you expecting the value you see in the form field to contain the zero on the end? Currently that will just display as .1 but the actual model value that Angular has will contain .10 Note that with latest version the mask has changed to mask="separator.2" and to use a comma you would also pass another attribute thousandSeparator=","
What I want to see is 1000.10 on when I patch my form control with a number value 1000.1
thanks.
What I want to see is 1000.10 on when I patch my form control with a number value 1000.1 thanks.
if separator.2 is assigned this would be the correct
No it doesn't show the extra 0 at the end, if I patch the control with 10.1
separator.2 should add extra one 0 at the end and make it 10.10 in my opinion to make it consistent.
For example my forms showing 10.15 in one place and 10.1 in other place. It is not consistent.
Yes. Just like in PHP and
number_format(10.1, 2) // 10.10
number_format(10.1, 2, ',') // 10,10
number_format(1000.1, 2, ',', '.') // 1.000,10
I can also confirm the issue with trailing zeros.
Example: Input with mask="separator.2" thousandSepartor="," and a value of 18500.1 Expected value: 18,500.10 Current Value: 18,500.1
The control is part of a reactive form.
Can you please elaborate on the usage of the snippet below?
Yes. Just like in PHP and
number_format(10.1, 2) // 10.10
We are also facing this issue, has anyone found a workaround?
I was forced to go to another library ngx-currency
We are also facing this issue (using version 11.1.5 and using forms). We've seen that there are 2 closed issues on a similar topic (#267, #307) but we couldn't make it work.
Are there any news on this?
any update on this? we are also facing the same issue
Any update on this?
@hunterTR @ColinMorris83 @bgl3317 @nagulapallinaveen @lramondev Thanks for your using Ngx-Mask. Please update to latest version. It example, all work as expected - https://stackblitz.com/edit/angular-xn8sjm?file=src%2Fmain.ts We add leadZero to lead zeros to end of the model
@andriikamaldinov1 Is there any way to keep the decimal places inside the input to display it to the user?