Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default symbol for current locale is used.
{{ currency_expression | currency[:symbol] }}
$filter('currency')(amount[, symbol])
amount – {number} –
Input to filter.
symbol(optional) – {string=} –
Currency symbol or identifier to be displayed.
{string}
– Formatted number.
<script> function Ctrl($scope) { $scope.amount = 1234.56; } </script> <div ng-controller="Ctrl"> <input type="number" ng-model="amount"/> <br/> default currency symbol ($): {{amount | currency}}<br/> custom currency identifier (USD$): {{amount | currency:"USD$"}} </div>
it('should init with 1234.56', function() { expect(binding('amount | currency')).toBe('$1,234.56'); expect(binding('amount | currency:"USD$"')).toBe('USD$1,234.56'); }); it('should update', function() { input('amount').enter('-1234'); expect(binding('amount | currency')).toBe('($1,234.00)'); expect(binding('amount | currency:"USD$"')).toBe('(USD$1,234.00)'); });