latest Post

Explain currency filter in AngularJS

One of the filters in AngularJS is the Currency Filter. This “currency” filter includes the “$” Dollar Symbol as the default. So we can use the following code as the html template format of Currency Filter.

{{ currency_expression | currency : symbol : fractionSize}}

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 used; we can use it as follows:

    <!-- by default -->

    Default Currency {{amount | currency}}

    User Defined

    To use different type of currency symbols we have to define our 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"}}

About Mallikarjun A

Mallikarjun A
Recommended Posts × +

0 comments:

Post a Comment