AngularJS currency Filter (original) (raw)

Last Updated : 08 Aug, 2022

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 2 parameters as mentioned above and described below:

Example 1: This example displays the number in Indian currency format with two decimals by using the currency filter in AngularJS.

HTML `

Currency Filter

GeeksforGeeks

AngularJS currency Filter

Currency filter with currency symbol and fraction size.

Amount : {{ amount | currency : "₹" :2}}

<script>
    var app = angular.module('gfgApp', []);
    app.controller('currencyCntrl', function ($scope) {
        $scope.amount = 75.648;
    });
</script>

`

Output:

Example 2: This example displays the number in currency format by using the currency filter in AngularJS.

HTML `

Currency Filter

GeeksforGeeks

AngularJS Currency Filter

Currency filter without currency symbol and fraction size.

Amount : {{ amount | currency}}

<script>
    var app = angular.module('gfgApp', []);
    app.controller('currencyCntrl', function ($scope) {
        $scope.amount = 38;
    });
</script>

`

Output: