ngMask icon indicating copy to clipboard operation
ngMask copied to clipboard

Money mask?

Open celsomtrindade opened this issue 9 years ago • 29 comments

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.

celsomtrindade avatar Sep 18 '15 11:09 celsomtrindade

+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

j-hernandez avatar Oct 01 '15 14:10 j-hernandez

+1

gsantiago avatar Oct 20 '15 17:10 gsantiago

+1

iagomelanias avatar Nov 01 '15 02:11 iagomelanias

+1

thiagorossener avatar Nov 16 '15 01:11 thiagorossener

+1

wcustodio avatar Nov 26 '15 10:11 wcustodio

+1

GustavoCostaW avatar Dec 02 '15 21:12 GustavoCostaW

+1

mackski avatar Dec 15 '15 06:12 mackski

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

danielbertini avatar Dec 16 '15 12:12 danielbertini

+1

nncl avatar Dec 29 '15 10:12 nncl

+1

rkeshmir avatar Feb 16 '16 11:02 rkeshmir

+1

DarrylD avatar Feb 29 '16 03:02 DarrylD

+1

diegohaz avatar Apr 11 '16 15:04 diegohaz

+1

eehaddad avatar Apr 12 '16 20:04 eehaddad

+1

danieloprado avatar May 06 '16 15:05 danieloprado

👍

gitarno avatar May 18 '16 14:05 gitarno

+1

dvinciguerra avatar Jul 24 '16 01:07 dvinciguerra

+1

AraanBranco avatar Aug 13 '16 22:08 AraanBranco

+1

dangnelson avatar Aug 31 '16 19:08 dangnelson

+1

lourdrivera123 avatar Sep 18 '16 20:09 lourdrivera123

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

agyrafa avatar Sep 29 '16 19:09 agyrafa

+1

lopesricardo avatar Oct 06 '16 17:10 lopesricardo

+1

williamknn avatar Jan 17 '17 16:01 williamknn

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

minasvisual avatar Feb 10 '17 19:02 minasvisual

@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!

celsomtrindade avatar Feb 10 '17 19:02 celsomtrindade

+1

ghost avatar Feb 24 '17 02:02 ghost

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(",", ""); } }]);

MichaelFedorchenko avatar Mar 04 '17 16:03 MichaelFedorchenko

+1

jamespsterling avatar May 23 '17 16:05 jamespsterling

+1

Iazzetta avatar Sep 18 '17 19:09 Iazzetta

+100500

ishapkin avatar Nov 26 '20 21:11 ishapkin