I'd like to achieve number formatting such that if the number is round there should be no decimal placeholders .00
and otherwise use 2 and only 2 decimal places. For example:
1.23 -> 1.23
1.23456 -> 1.24
1.2 -> 1.20
1.0 -> 1
1 -> 1
According to the docs, you can only specify range of decimal places (e.g. |number:'.0-2'
) and not specific choice (e.g. |number:'.0,2'
); am i right or is there a way?
I'm aware I could achieve the same with some *ngIf
-s but would like to avoid if possible.