Filter number as us dollar

Description

The following code shows how to Filter number as us dollar.

Example


<!--from   w  w w.  j  ava 2 s.co m-->
<!DOCTYPE html>
<html  ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
<script type='text/javascript'>
function Ctrl($scope) {
  $scope.amount = 1234.56;
}
</script>
</head>
<body>
  <div ng-app="">
  <div ng-controller="Ctrl">
    <input type="number" ng-model="amount"> <br>
    default currency symbol ($): {{amount | currency}}<br>
    custom currency identifier (USD$): {{amount | currency:"USD$"}}
  </div>
</div>

</body>


</html>

Click to view the demo





















Home »
  AngularJS »
    AngularJS Example »




Controller
Directives
Expression
Filter
Form
Inject
Scope
Server
Style
Template
Utilities