Skip to content
Related Articles

Related Articles

Improve Article
AngularJS | currency Filter
  • Last Updated : 01 Jun, 2021

AngularJS currency filter is used to convert a number into a currency format. If no currency format is specified currency filter uses the local currency format.
Syntax: 
 

{{ currency_expression | currency : symbol : fractionSize}}

Parameters: It contains two parameters as mentioned above and described below: 
 

  • symbol: It is optional parameter. It is used to specify the currency symbol. The currency symbol can be any character or text.
  • fractionsize: It is optional parameter. It is used to specify the number of decimals.

Example 1: This example displays the number in Indian currency format. 
 

html




<!DOCTYPE html>
<html>
    <head>
        <title>Currency Filter</title>
         
        <script src=
        </script>
    </head>
     
    <body>
  
        <div ng-app="gfgApp" ng-controller="currencyCntrl">
             
            <h3>
                Currency filter with curreency
                symbol and fraction size.
            </h3>
             
             
<p>Amount : {{ amount | currency : "Rs" : 2}}</p>
 
        </div>
  
        <script>
            var app = angular.module('gfgApp', []);
             
            app.controller('currencyCntrl', function($scope) {
                $scope.amount = 75;
            });
        </script>
    </body>
     
</html>

Output: 
 



Example 2: This example display the number in currency format. 
 

html




<!DOCTYPE html>
<html>
    <head>
        <title>Currency Filter</title>
         
        <script src=
        </script>
    </head>
     
    <body>
  
        <div ng-app="gfgApp" ng-controller="currencyCntrl">
             
            <h3>
                Currency filter without currency
                symbol and fraction size.
            </h3>
             
             
<p>Amount : {{ amount | currency}}</p>
 
        </div>
  
        <script>
            var app = angular.module('gfgApp', []);
             
            app.controller('currencyCntrl', function($scope) {
                $scope.amount = 38;
            });
        </script>
  
    </body>
</html>

Output: 
 

 




My Personal Notes arrow_drop_up
Recommended Articles
Page :