I have a number property that the user can edit in an input field.
The number is bound to the input with [(ngModel)]=<value>
The input only shows the necessary fraction digits but I want it to show always at least 2 fraction digits. e.g. the number is 12.1 is displayed as '12.1' but i want it to be 12.10 just as if i would use the numberpipe as following <value> | number '.2'
. Since it is a two-way binding angular disallows the use of pipes.
What I expect:
- 12 ---> 12.00
- 12.1 ---> 12.10
- 12.12 ---> 12.12
- 12.123 ---> 12.123
- null ---> empty