assisrafael / assisrafael/angular-input-masks

"Error: value.toFixed is not a function" on ui-money-mask when ng-model value is of type float

Open
#90 2 comments 0 reactions 0 assignees View on GitHub
needs: more info
Dominant language
JavaScript
Stars
955
Forks
329
PR merge metrics
No merged PRs in 30d

Description

When a ng-model is loaded with a floating value, I get the title of the message. For example:

$scope.value = 345.00;

To solve, I changed the following line:

return moneyMask.apply(value.toFixed(decimals).replace(/[^\d]+/g,''));

To:

return moneyMask.apply(parseFloat(value).toFixed(decimals).replace(/[^\d]+/g,''));

And then it worked. Confirms this bug?
##

---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/22270524-error-value-tofixed-is-not-a-function-on-ui-money-mask-when-ng-model-value-is-of-type-float?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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.