Is there a more efficient way for users to input a decimal number like 64.32
, and have it be two-way-bound to a property of type number
?
I attempted to use
<input type="number" [(ngModel)]="size">
However, this displays a spinner which isn't ideal for entering a fractional number of this size and takes up unnecessary space.
I also experimented with
<input [(ngModel)]="size">
But this results in the model property storing a string
rather than a number
.
Currently, I am converting between string
and number
using a setter/getter, but I believe there must be a better solution. Any suggestions?