assisrafael / assisrafael/angular-input-masks
bug(money-mask): wrong number formating when value and decimals are setted asychronously
- Dominant language
- JavaScript
- Stars
- 955
- Forks
- 329
- PR merge metrics
- No merged PRs in 30d
Description
Hi there.
I'm facing a problem with the money-mask. When the value and decimals are coming from a response from the server the money-mask formats the value wrong.
Codepen: http://codepen.io/marcomafessolli/pen/akEEYR
Looking into the code, it happens here: `clearDelimitersAndLeadingZeros((parseFloat(value)).toFixed(decimals));`, specifically here: `(parseFloat(value)).toFixed(decimals)`. Because of that, a number with 3 decimals, when first setted, goes into the parser formatter with 2 decimals and gets rounded, losing one of the decimals.
##
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/36056067-bug-money-mask-wrong-number-formating-when-value-and-decimals-are-setted-asychronously?utm_campaign=plugin&utm_content=tracker%2F1022469&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1022469&utm_medium=issues&utm_source=github).
Contributor guide
Assessment
This issue has not been assessed yet.