angular-input-masks
angular-input-masks copied to clipboard
Make 'ui-money-mask' come 'R$ 12,00' instead 'R$ 00,12' when you type '12'
There is some way (additional attribute or something like) to put values from left to right on 'ui-money-mask'?
For example:
When you type '12' on your keyboard the mask comes: 'R$ 00,12' There's some way to come 'R$ 12,00'? And only let you type a cents value when you press the 'comma key'?
Unfortunately not. But it should not be difficult to implement. Pull requests are welcome.
- 1
@assisrafael I'll do. How can I call this feature?
So, I've tried to implement this feat and here are some updates.
The expected behavior is that the user types a unlimited number of numbers and when he presses the decimalDelimiter, it adds the decimalDelimiter into the mask so that the user can type the decimals. if the user never types the decimalDelimiter, the formatted value will be: $ 99999. Considering this, decimalDelimiter and decimals are optional (mask value: currency + recursive number + optional decimals.
The problem is that angular-input-mask uses StringMask to format the users input data and StringMask doesn't allow optional characters (In this case, the decimalDelimiter).
I've tried to create a new StringMask when the user presses the decimalDelimiter but it will require a complex logic to control when the value coming from the server have decimalDelimiter and create the correct mask to it, to control when the user presses backspace to clear only the decimals until the decimalDelimiter and so on.
@assisrafael Do you have something in your mind in how implement this feature?
Hi are there any updates on this missing feature?
+1
I'm working on this issue, i changed the place where validations occurs to "onBlur" event, (yeah, i've looked so many javascript frameworks that do this kind of validation and it is the best alternative), i only have one question, how can i call this feature? uiOnBlurValidation? and, @assisrafael this frameworks have some config options that can be set on angular.module().config() ?
The current progress:

Does anyone have a pull request/fix for this?
@Devqon I did a commit on my fork: https://github.com/rafaelzomer/angular-input-masks/tree/uiLeftToRight
@assisrafael you resolve this?
+1
+1