I want to show the result of a test:
<span>{{test.correctCount / test.questions}}</span>%
But how can I show this as an integer number correctly rounded?
I want to show the result of a test:
<span>{{test.correctCount / test.questions}}</span>%
But how can I show this as an integer number correctly rounded?
According to the documentation:
https://docs.angularjs.org/api/ng/filter/number
You can do it like this:
{{ number_expression | number : fractionSize}}
Also in this post there is an answer: Math functions in angular bindings (post by Andrew Kuklewicz)
<span>{{{{test.correctCount / test.questions}} | number:0}}</span>%
Now its upto you ,How you want to show the result.
Use number:0 for (96%)
use number:2 if you want to show like that (96.20%)