This filter is used to format the number to currency ( i.e, to display $/Rs symbol infront of number and specify number of decimals after floating point )
Ex:
$scope.amount = 1234.56
syntax:
{{ currency_expression | currency : symbol : fractionSize}}
Note: default symbol for currency is $, and default fractionSize is 2
Task1:
<h1> {{ amount | currency}} </h1>
o/p: $1234.56
Task2:
<h1> {{ amount | currency:"USD$"}} </h1>
o/p: USD$1234.56
Task3:
<h1> {{ amount | currency:"USD$":3}} </h1>
o/p: USD$1234.560
Ex:
$scope.amount = 1234.56
syntax:
{{ currency_expression | currency : symbol : fractionSize}}
Note: default symbol for currency is $, and default fractionSize is 2
Task1:
<h1> {{ amount | currency}} </h1>
o/p: $1234.56
Task2:
<h1> {{ amount | currency:"USD$"}} </h1>
o/p: USD$1234.56
Task3:
<h1> {{ amount | currency:"USD$":3}} </h1>
o/p: USD$1234.560
No comments:
Post a Comment