Ngx-mask: Negative numbers on thousand separator is not worrkring

Created on 27 Mar 2019  路  8Comments  路  Source: JsDaddy/ngx-mask

Hi, I have an issue with the thousand separator mask and negative numbers.

Have this function in my component

getIncome() {
  const testValue = 5 - 1000;
  return testValue; 
  // testValue output is -995
}

Have this expression in my template

<div>
{{ getIncome() | mask: 'dot_separator' }} 
   // expression outputs -99
   // should output  -995
</div>

The output is cutting off the last number from a negative number. I looked through the documentation and issues and I can't find any issues or fixes related to this.
H

P1 bug

Most helpful comment

Again they close this issue without a resolution. good job.

All 8 comments

@cnthiesen you should write like this
< div mask="dot_separator" > {{ getIncome()}} </div>

Hi!
@ValeriaKochegarova
I have a problem with negative numbers and comma separator, it's not working. I tried this example and I can't make it work. I can't use negative in inputs, and when I use pipe the negative character it's not shown. What I'm doing wrong? Should I have to install something else? My angular version is: 7.2.4 and ngx-mask version: 7.9.2 .
I hope you can help me. Thanks!

Again they close this issue without a resolution. good job.

I still can't use negative numbers on version 8.0.5

@NepipenkoIgor

677 I think it is not working after try new input [allowNegativeNumbers]

stackblitz: https://stackblitz.com/edit/chimung-angular-8-ngx-mask

Change the ngx-mask version to 9.0.0 in the stackblitz and try again. It's fixed, the only thing broke is the pipe as that doesn't cater for negative numbers currently.

Hi @ColinMorris83 , but it seem has peer deps on angular 9. Does it working correctly in angular 8 ? Thanks for quick response.

I think most likely it needs to be angular 9 as that will use typescript 3.8, same version used to build the library. You can try with 8 though, it seems to work ok in the stackblitz which is angular 8.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dissy123 picture dissy123  路  3Comments

Wisdomb33r picture Wisdomb33r  路  3Comments

raisiqueira picture raisiqueira  路  3Comments

Et3rnal picture Et3rnal  路  4Comments

ghost picture ghost  路  3Comments