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

Make 'ui-money-mask' come 'R$ 12,00' instead 'R$ 00,12' when you type '12'

Open rafaelzomer opened this issue 8 years ago • 12 comments

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'?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/26565771-make-ui-money-mask-come-r-12-00-instead-r-00-12-when-you-type-12?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).

rafaelzomer avatar Sep 09 '15 18:09 rafaelzomer

Unfortunately not. But it should not be difficult to implement. Pull requests are welcome.

assisrafael avatar Sep 11 '15 14:09 assisrafael

  • 1

raczynskil avatar Jan 30 '16 17:01 raczynskil

@assisrafael I'll do. How can I call this feature?

marcomafessolli avatar Jun 14 '16 19:06 marcomafessolli

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?

marcomafessolli avatar Jun 15 '16 19:06 marcomafessolli

Hi are there any updates on this missing feature?

FloMaetschke avatar Jul 06 '16 12:07 FloMaetschke

+1

guylhermetabosa avatar Nov 18 '16 19:11 guylhermetabosa

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: exemple

rafaelzomer avatar Feb 14 '17 11:02 rafaelzomer

Does anyone have a pull request/fix for this?

Devqon avatar Aug 17 '17 11:08 Devqon

@Devqon I did a commit on my fork: https://github.com/rafaelzomer/angular-input-masks/tree/uiLeftToRight

rafaelzomer avatar Aug 17 '17 12:08 rafaelzomer

@assisrafael you resolve this?

JorgeSegtowich avatar Feb 23 '18 18:02 JorgeSegtowich

+1

ganholete avatar Apr 30 '18 14:04 ganholete

+1

alinearielo avatar Jun 12 '18 19:06 alinearielo