Is there a way to ensure that numbers are always displayed with two decimal places precision in ion-input? For example:
1.01
1.10
1.20
1.23
Instead of displaying as 1.1 and 1.2, they should appear as 1.10 and 1.20.
In my model:
export class HomePage {
public myValue:number;
}
The corresponding html file looks like this:
<ion-content padding>
<h3>Hello</h3>
<ion-row margin-right="50px" margin-left="50px">
<ion-input type="number" ng-pattern="/^[0-9]+(\.[0-9]{1,2})?$/" step="0.01"
[(ngModel)]="myValue" placeholder="0.00"></ion-input>
</ion-row>
</ion-content>
I have also attempted using the following simpler code:
<ion-input type="number" step="0.01"
[(ngModel)]="myValue" placeholder="0.00"></ion-input>
This solution works on web browsers (MacOS, 55.0.2883.95) but fails on Android devices (tested on version 7.1).
Any ideas to resolve this issue?