jeudi 14 avril 2016

Restricting number to 2 decimal places in HTML file with AngularJS

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.




Aucun commentaire:

Enregistrer un commentaire