Reputation: 386
Can someone please clarify this for me? How can I format a number in the view if the data is received from an API call (I can't format this on the back end).
For example, let score = '0.929304045';
In the template:
<div> {{ score }} </div>
If I add a computed function to do the formatting for me:
getScore(score) {
return score.toFixed(2);
}
It gives me an error
_vm.getScore is not a function
If I call {{ getScore(score) }}
in the view.
Any clarity on this will be greatly appreciated.
Upvotes: 1
Views: 46