0

I have calculated some data usign javascript and result is printing like this (56666.666666666664%). and I need to convert the result in like 56.66%. Below is a Javascript which print the above result.

$scope.totaTaken = (totalT / data.length)*100;
MAR
  • 335
  • 3
  • 4
  • 13

1 Answers1

3

If you're looking for a JavaScript solution (where you do it in a controller or directive), the given comments answer your question (see toFixed). If you're looking for an AngularJS solution, where you format the value in the view, check out the number filter which was made for this!

Steve Klösters
  • 9,337
  • 2
  • 39
  • 53