Currency Filter in AngularJS

Description

It formats a number as a currency. To describe a currency we need some currency symbols, And to design that type of symbols we need unicode or Hexa-Decimal value of that symbol. Currency HTML Codes, this website have all the unicode and Hexa-Decimal currency symbols.

How to use Currency Filter in AngularJS

There are two ways by which, we can use Currency Filter.

Default - If we did not provide any currency symbol then by default Dollar-Sign will be use we can use it like as follows:

<!-- by default -->
Default Currency: {{amount | currency}}

User Defined - To use different type of currency symbol we have to define own symbol by using the unicode or Hexa-Decimal code of that Currency.

E.g. - For Example If we want to define Indian Currency Symbol then we have to use (Unicode-value) or (Hexa-Decimal value.

Indian Currency: {{amount | currency:"&# 8377"}}

Code

<!doctype html>

<html ng-app>
<
head>
    <script src="angular.min.js"></script>

</
head>
<
body>
    <input type="number" ng-model="amount">

    <br>

    <h1>

        Default currency($): {{amount | currency}}<br>

        <br>

        Indian Currency: {{amount | currency:"&# 8377"}}</h1>

</
body>
</
html>

Output

Currency Filter