我想要格式化一个数字并用角度对它进行复数化。如何在angularjs中复数化和格式化一个数字
例如(给定数量的比特币的):
0 => "John has no bitcoins"
1 => "John has 1 bitcoin"
2 => "John has 2 bitcoins"
12345.6789 => "John has 12,345.67 bitcoins"
我已经试过:
John has
<ng-pluralize count="bitcoin_amount | round:2"
when="{'0': 'no bitcoins',
'1': '1 bitcoin',
'other': '{} bitcoins'}">
</ng-pluralize>
但失败草草收场,因为对数字等于或大于1000更大,他们是在count
属性中作为1,000
传递,因此只显示了数千个。 如:
1001 => 1
1000 => 1
2000 => 2
etc...
尝试的this demo箱number of people
为例粘贴1,000
。
如何格式化数字并将其复数化为角?