2
I need to make a value mask (9 digits with 3 decimals), and when the user starts to enter the value, the field place the commas and point automatically, similar to what happens today in the bank systems, where in the field we have the 0,00 and as we enter the value goes to the left.
Example: I want to inform R $ 12,67
Input: 0,00
0,01
0,12
1.26
12,67
I’ve tried alternatives with external libs, but they only have effect on fields with type "Text", and because I’m developing for a tablet, I don’t want the keyboard to open with words, just numbers. My input type today is number, however on Samsung devices, not listed the option of "," or "." only the number.
My code is like this:
<ion-input type="number" #input name="quantidade" [(ngModel)]="quantidade" required></ion-input>
Use the
type
tel
– Roberto de Campos
It still doesn’t work @Robertofagundes. I need it to behave according to the example of the question.
– Carlos Bridi
I tried to do this in several ways, but always came across some problem (e.g., the user can paste numbers or click in the middle of the number and continue typing). The solution I found was to open a modal with a kind of calculator for the user to inform the value.
– NilsonUehara