angular-input-masks icon indicating copy to clipboard operation
angular-input-masks copied to clipboard

Pasting whole number results in wrong formatting when decimals are used.

Open kjavia opened this issue 9 years ago • 3 comments

We are using ui-money-mask directive with 2 decimals.

When the user pastes whole numbers like 123456 in the text box, the last 2 digits are taken to be decimals by the directive. So the value in the text box becomes $ 1234.56 which is not what the user expects. This is clearly a defect for us but I am not sure if you would consider this as a general defect or as designed?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/26588984-pasting-whole-number-results-in-wrong-formatting-when-decimals-are-used?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).

kjavia avatar Sep 10 '15 15:09 kjavia

Can you write a test case to show the wrong behaviour?

assisrafael avatar Sep 11 '15 14:09 assisrafael

The same behavior occurs for the ui-number-mask. I've created a jsfiddle as example, because unfortunately I don't have the know how to write test cases in javascript

ddegasperi avatar Oct 26 '16 09:10 ddegasperi

I had to resort to adding my own code inside a ng-paste directive on the same element to circumvent this issue.

https://docs.angularjs.org/api/ng/directive/ngPaste

kjavia avatar Nov 04 '16 01:11 kjavia