Ngx-mask: Mask ignores the decimal marker for decimals with thousand separator set to "."

Created on 19 Jun 2020  路  3Comments  路  Source: JsDaddy/ngx-mask

Hello,

We have the following issue when using the ngx-mask for decimal numbers:

  • mask: "separator.2"
    -thousandSeparator: "."
    -test value: 1234567.89

-ngx-mask version: 9.1.2

When the user enters the number manually, we get the correct result:

  • Input: 1.234.567,89
  • Form Control Value: 1234567.89

However, when we set the same value programmatically we get the following results:

  • Input: 123.456.789
    -Expected Input: 1.234.567,89
  • Form Control Value: 1234567.89

Thank you so much,
Dimitris

Most helpful comment

Hello,

After several tests, the only way that worked as expected was by adding "decimalMarker" directly in "input":
<input type="text" prefix="R$ " mask="separator.6" thousandSeparator="." decimalMarker="," inputmode="numeric" />

All 3 comments

the same issue happens to me.
the different I setting configuration from import module with
NgxMaskModule.forRoot({decimalMarker: ',', thousandSeparator: '.'})

any suggestions for this matter?

Thanks
Yudi

Not sure if it is the best way to deal with this problem, but I have done the following

First: Set the FormControl with a value that the mask accept
this.myFormGroup.get('price').setValue('52,99');
and then set the value again with the option emitModelToViewChange as false
this.myFormGroup.get('price').setValue(52.99, {emitModelToViewChange: false});

Hello,

After several tests, the only way that worked as expected was by adding "decimalMarker" directly in "input":
<input type="text" prefix="R$ " mask="separator.6" thousandSeparator="." decimalMarker="," inputmode="numeric" />

Was this page helpful?
0 / 5 - 0 ratings

Related issues

raisiqueira picture raisiqueira  路  3Comments

v1d3rm3 picture v1d3rm3  路  4Comments

tanjuyayak picture tanjuyayak  路  3Comments

Wisdomb33r picture Wisdomb33r  路  3Comments

ljjolic picture ljjolic  路  4Comments