5
我希望在我的网站内的特定表格中显示价格至小数点后3位。AngularJS:货币格式。更改分数大小,千分位分隔符和分数分隔符
价格将以磅,美元和欧元显示。
我的货币过滤器似乎自动将价格四舍五入到小数点后两位。
此外,如果货币是欧元,理想情况下,我想自动将千位分隔符更改为.
并将小数点分隔符更改为,
。
angularjs是否支持这个?
观
<div ng-controller="SpotController">
<table class="header-table-spot-prices">
<thead>
<tr><th>Spot Prices</th><th>Price</th></tr>
</thead>
<tbody>
<tr ng-repeat="spot in spots">
<td>{{ spot.item }}</td>
<!-- This needs to be 3dp -->
<td>{{ spot.price | currency:spot.currency }}</td>
</tr>
</tbody>
</table>
</div>
这里介绍的解决方案不足之处在于它只用'“。”'替换第一个'','''。因此它对于超过1000000的数字将无法正确工作。更好的解决方案是:'input = input.split(“,”)。join(tempString).replace(“。”,“,”)。split(tempString)。加入( “”);' – nplatis