I'm trying to format the value of an input field while I am typing into it.
<input (change)="test()" [(ngModel)]="testModel">
When I am trying this:
test() {
this.testModel = 2;
}
I would expect the visible text of my input to change to 2 on every input change. But nothing really is happening except the first character changes and console tells me the text did change (not visible though).
While when I am trying this:
test() {
this.testModel += 'a';
}
it works perfectly and adds an 'a' to the value on every type.
I'm trying to achieve that 1200 becomes 1.200€ while I am typing 1200. Thanks