数値を書式化して角をつけて複数形にしたい。例えばanglejsで数値を複数形にしてフォーマットする方法
(bitcoinsの数を与えられた):
私が試した何 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
を貼り付けてください。
数値を整形して複数形にするにはどうすればよいですか?