amarkes / br-masker-ionic-3

mascara para inputs
MIT License
110 stars 32 forks source link

Not able to parse the input data to a float number #80

Open MatheusMinguiniPostGraduation opened 4 years ago

MatheusMinguiniPostGraduation commented 4 years ago

As soon as my controller reads the input value, for example: R$ 2342,50, it is an String. Therefore, I want to convert it to a number in order to manipulate it arithmetically, like: 2,00 + 2342,50

The thing is: When I convert the string to a float by doing it -> parseFloat('2342,50'), I lose the decimal part and it becomes 2.342

Is there a way to put ' . ' instead of a comma ' , ' ?

Thanks, guys

gabriel-cardoso-oliveira commented 4 years ago

I used it like this [brmasker]="{money: true, decimalCaracter: '.', decimal: '2'}"