How to represent a decimal scaled number in HTML input with Angular

Viewed 13

I have an Angular component that looks like this...

export class CreateComponent implements OnInit {

    public scale: number = 2; // 2 decimal places
    public quantity: number = 1000; // When scaled, this number is 10.00
}
<input [(ngModel)]="quantity" type="number">

How can I get the number in the input to be presented with a decimal place, but still be represented as an unscaled value in the component?

i.e. the input should display 10.00 when the unscaled value is 1000 and the scale is 2

0 Answers
Related