specific question!
Is there a way to allow user to input comma and dot as a decimal marker, but keep the dot in displayed value and then trim thousand separators?
User inputs "123456,78", sees "123 456.78", value is "123456,78"
User inputs "123456.78", sees "123 345.78", value is "123456.78"
Cant find any way to achieve this result with ngx-mask
Thanks in advance!
Update: seems stackoverflow needs some debugging but I have zero clue what info is needed cuz I just dont see any way I can achieve this functionality. Ok, I'll show what I tried.
I tried custom patterns, like this:
customPatterns = {
D: {
pattern: new RegExp('[,.]'),
symbol: '.',
},
0: { pattern: new RegExp('\\d') },
};
...
[mask]='0*D00'
But symbol
doesnt work for some reason, comma stays displayed if you input it
And I tried something like [mask]="'0*(,|.)00'"
, but it doesnt work at all
Update: here is my final imask config:
{
mask: Number,
scale: 2,
signed: true,
thousandsSeparator: ' ',
padFractionalZeros: true,
normalizeZeros: true,
radix: '.',
mapToRadix: [',', '/']
}