我希望在我的网站中特定的表格中以3位小数显示价格。
价格将以英镑、美元和欧元显示。
我的货币过滤器似乎自动将价格舍入到2位小数。
此外,如果货币为欧元,最好将千位分隔符自动更改为 .
,小数分隔符更改为 ,
。
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).join(".");
- nplatis