ngx-mask
ngx-mask copied to clipboard
How to mask optionally negative number with digits after coma (-2,2321; 2,321; -123; 232)?
Hi,
Is there any posible way to create a mask for optionally negative number with optional unlimited digits after coma?
My inputs:
- -12345..9.2
- -1,222222222222
- 12345,2
- 111111111111.2
- 1234567
- -1
I tried this pattern, but i can't type dot if i dont type '-' character before
mask="M9*D9*"
[patterns]="numericCustomPattern"
[allowNegativeNumbers]="true"
[dropSpecialCharacters]="false"
numericCustomPattern = {
'M' : { pattern : new RegExp('-?') },
'9' : { pattern : new RegExp('[0-9]') },
'D' : { pattern : new RegExp(/[.,]/g) }
};