Improve this Doc  View Source

currency

  1. - filter in module ng

Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default symbol for current locale is used.

Usage

In HTML Template Binding

{{ currency_expression | currency : symbol : fractionSize}}

In JavaScript

$filter('currency')(amount, symbol, fractionSize)

Arguments

Param Type Details
amount number

Input to filter.

symbol
(optional)
string

Currency symbol or identifier to be displayed.

fractionSize
(optional)
number

Number of decimal places to round the amount to, defaults to default max fraction size for current locale

Returns

string

Formatted number.

Example

<script>
  angular.module('currencyExample', [])
    .controller('ExampleController', ['$scope', function($scope) {
      $scope.amount = 1234.56;
    }]);
</script>
<div ng-controller="ExampleController">
  <input type="number" ng-model="amount" aria-label="amount"> <br>
  default currency symbol ($): <span id="currency-default">{{amount | currency}}</span><br>
  custom currency identifier (USD$): <span id="currency-custom">{{amount | currency:"USD$"}}</span>
  no fractions (0): <span id="currency-no-fractions">{{amount | currency:"USD$":0}}</span>
</div>