AngularJS Tutorial - Filter number as us dollar








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

Example


<!--   w ww  .  j  av a 2 s .c om-->
<!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>

The code above is rendered as follows: