数値をフォーマットし、角度で複数形にしたい。
例(ビットコインの数が与えられた場合):
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 以上の数値1,000
はcount
属性のように渡されるため、1000 だけが表示されるからです。例えば:
1001 => 1
1000 => 1
2000 => 2
etc...
例として、このデモ1,000
のボックスnumber of people
に貼り付けてみてください。
数値をフォーマットし、angular で複数形にするにはどうすればよいですか?