Issue
I have a HTML page that displays the information from an AngularJS controller. This is part of the code:
<td id="calories">{{ ctrl.caltotal }}</td>
My question is, what do I need to do so that this is displayed at a maximum of 2 decimal places? At the moment if I change the program it can give values like 23.00000004. Is this a change that should be made in the Angular Controller or in the HTMl view? Thanks.
Solution
<td id="calories">{{ ctrl.caltotal | number:2}}</td>
That will restrict it to two decimal places.
Answered By - rrd
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.