candreoliveira / ngMask

Best Angular mask alternative! No jQuery, pure JS. About ~6kb!
http://candreoliveira.github.io/#/ngMask
ISC License
419 stars 171 forks source link

Money mask? #68

Open celsomtrindade opened 9 years ago

celsomtrindade commented 9 years ago

Does it have a way to create a money mask? Or to 'reverse fill' the input? I tried to use this mask: mask="9.99?9,99" but it doesn't work because it fills from left to right. If at least it was from right to left, it could work.

Is there a way to create a currency mask? Didn't found anything on the docs about it.

j-hernandez commented 9 years ago

+1 - currently running into an issue where need to allow users to input money values up into the millions and comma handling is extremely tricky. I've almost got it working with: $9?9?9?,?9?9?9?,?9?9?9? - however it is confusing users because both commas appear when typing and they feel that something is incomplete about the field

gsantiago commented 9 years ago

+1

iagomelanias commented 9 years ago

+1

thiagorossener commented 8 years ago

+1

wcustodio commented 8 years ago

+1

GustavoCostaW commented 8 years ago

+1

mackski commented 8 years ago

+1

danielbertini commented 8 years ago

You can set a style in input field with: style="direction:rtl;" and mask with mask="R$99,999.99"

nncl commented 8 years ago

+1

rkeshmir commented 8 years ago

+1

DarrylD commented 8 years ago

+1

diegohaz commented 8 years ago

+1

eehaddad commented 8 years ago

+1

danieloprado commented 8 years ago

+1

gitarno commented 8 years ago

👍

dvinciguerra commented 8 years ago

+1

AraanBranco commented 8 years ago

+1

dangnelson commented 8 years ago

+1

lourdrivera123 commented 8 years ago

+1

agyrafa commented 8 years ago

i used the @danielbertini suggestion, but the number 0 didnt seems to work with the mask

lopesricardo commented 8 years ago

+1

williamknn commented 7 years ago

+1

minasvisual commented 7 years ago

After some tests i get a nice result with this: mask="9?9?9?9?9?9?9?9?9.99"

celsomtrindade commented 7 years ago

@minasvisual It will "work" but it doesn't have the money prefix, like R$, US$, etc.. Also, it doesn't add the proper pontuation. For example, if I type 149990 it's not going to convert to R$1.499,90 it will be 1499,90.

I know it may work for you, but it would be nice to have a proper money mask built in.

Note: I'm also not juding your method! Far from that! I'm just poiting out what it's missing and trying to show why we still need an actual money mask.


Just a side note: I was able to create a directive to turn numbers into a money mask and it work as expected. I just need to check how it can be implemented with this module. I'll make my files public so if anyone can help with that, it would be great!

ghost commented 7 years ago

+1

MichaelFedorchenko commented 7 years ago

Resolved this problem with help custom filter and replaced comma on "" app.filter('toString', ['$filter', function($filter) { return function(string) { return $filter('currency')(string, '', 2).replace(",", ""); } }]);

jamespsterling commented 7 years ago

+1

Iazzetta commented 7 years ago

+1

ishapkin commented 3 years ago

+100500