AngularJS currency Filter
Definition and Usage
currency
Filters format numbers into currency format.
By default, the regional currency format is used.
Related Pages
AngularJS Tutorial:Angular Filters
Instance
Example 1
Display numbers as currency format:}}
<div ng-app="myApp" ng-controller="costCtrl"> <p>Price = {{ price | currency }}</p> </div>
Example 2
Display price in Norwegian currency format:
<div ng-app="myApp" ng-controller="costCtrl"> <p>Price = {{ price | currency : "NOK" }}</p> </div>
Example 3
Display price with three decimal places:
<div ng-app="myApp" ng-controller="costCtrl"> <p>Price = {{ price | currency : "NOK" : 3 }}</p> </div>
Syntax
{{ number | currency : symbol : fractionsize }}
Parameter
Parameter | Description |
---|---|
symbol | Optional. The currency symbol to be displayed. This symbol can be any character or text. |
fractionsize | Optional. Number of decimal places after the decimal point. |