I am using ng-bind to bind the value of price
<td><span ng-bind="'$' o.Price"></span></td>
but it is taking value like this 281.96000000000004 so how can I restrict this value in view so it takes only two digits after decimal. like 281.96.
I am using ng-bind to bind the value of price
<td><span ng-bind="'$' o.Price"></span></td>
but it is taking value like this 281.96000000000004 so how can I restrict this value in view so it takes only two digits after decimal. like 281.96.
Share Improve this question edited Aug 14, 2017 at 8:52 AVJT82 73.4k25 gold badges145 silver badges170 bronze badges asked Aug 14, 2017 at 8:51 Gaurav_0093Gaurav_0093 1,0307 gold badges30 silver badges58 bronze badges3 Answers
Reset to default 7use the number
filter
<td><span ng-bind="'$' + (o.Price | number : 2)"></span></td>
You can use the currency filter (if it's a price in dollars):
<td><span>{{ o.Price | currency }}</span></td>
you can use angular filter | number : fractionSize
for two decimal places fractionSize use:
<td><span ng-bind="'$' o.Price| number : 2"></span></td>