- Currency filter is one of the AngularJS Filters.
- It is defined by formats a number as a currency. ($565)
- The currency filter takes as a default value is locale currency format $.
Syntax:
Parameter Values:
Value |
Type |
Description |
symbol |
string |
It displays the currency symbol. The symbol can be present in some character or text and it is optional. |
fractionsize |
number |
To round the decimal places in the amount. |
Sample coding for currency Filter:
currency filter in AngularJS:
The multiplication and addition value will be displays with currency symbol.
Code Explanation for currency Filter:
- The ng-app specifies the root element (<div>) to define AngularJS application.
- The expression 200*50 executed and the output will be displayed with $ symbol in <p> tag.
- The expression 105+10 executed and the output will be updated “NOK” symbol in <p> tag.
Sample output:
- The output displays the multiplication of two numbers with $ symbol
- The output displays the addition of two numbers with “NOK” symbol.
AngularJS Filters list:
Filter |
Description |
currency |
It is used to formats a number as a currency(i.e $589) Current Locale is the default symbol. |
date |
It is used to design a date for specified format. |
filter |
It is used to select a subset of items from an array and it returns the new array. |
json |
It is used to convert a JavaScript object into JSON string. |
limitTo |
It is used to returns an array or a string containing only a specified number of elements |
lowercase |
It is used to converts string to a lowercase. |
number |
It is used to formats a number to a string or text. |
orderBy |
It is used to specify orders an array by an expression |
uppercase |
It is used to converts string to a uppercase. |