Issue
I have used the number pipe below to limit numbers to two decimal places.
{{ exampleNumber | number : '1.2-2' }}
I was wondering what the logic behind '1.2-2' was? I have played around with these trying to achieve a pipe which filters to zero decimal places but to no avail.
Solution
The parameter has this syntax:
{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}
So your example of '1.2-2'
means:
- A minimum of 1 digit will be shown before decimal point
- It will show at least 2 digits after decimal point
- But not more than 2 digits
Answered By - rinukkusu Answer Checked By - David Goodson (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.