Ngx-mask: Brazilian currency

Created on 21 Nov 2019  路  4Comments  路  Source: JsDaddy/ngx-mask

I'm having problems with the mask for Brazilian currency, see the image below, on the right side of the image you can see the result.

Captura de Tela_selecionar 谩rea_20191121100439

I would need to do the formatting as follows:
R$ 1.200,34

If you add more numbers, you should do the following format:
R$ 120
R$ 1.200,34
R$ 12.000,34
R$ 120.000,34
R$ 1.200.000,34

I would also need that even if I type only 120, in the end it will automatically include ,00. Getting 120,00

If anyone can help me, I appreciate it.

Most helpful comment

for me too, i'm sorry i forget to update that. So, what a did?

mask="separator.2"
[thousandSeparator]="'.'"
[decimalMarker]="','"
prefix="R$ "
title="{{ label | translate }}"
type="text"
[dropSpecialCharacters]="true"
[ngModel]="value"
(ngModelChange)="onValueChanges($event)"
>

All 4 comments

use it mask="dot_separator.2"

did not work

for me too, i'm sorry i forget to update that. So, what a did?

mask="separator.2"
[thousandSeparator]="'.'"
[decimalMarker]="','"
prefix="R$ "
title="{{ label | translate }}"
type="text"
[dropSpecialCharacters]="true"
[ngModel]="value"
(ngModelChange)="onValueChanges($event)"
>

this is my implementation, and i put that implementation into a new component named app-currency, with that static configurations, and it works.!!! this dot_separator.2 doesnt works anymore in new versions

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TimWarp picture TimWarp  路  4Comments

Wisdomb33r picture Wisdomb33r  路  3Comments

renanBritz picture renanBritz  路  3Comments

v1d3rm3 picture v1d3rm3  路  4Comments

eehaddad picture eehaddad  路  3Comments