Tuesday 31 March 2015

AngularJS Convert Number to Currency Format


//HTML

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Limit Number to 2 decmial places in Angularjs</title>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular.min.js"></script>
    <script type="text/javascript">
      var myApp = angular.module('divid', [])
      myApp.controller("expressionController", function ($scope) {
      $scope.amount = 99999.56;
      });
    </script>
  </head>
  <body>
    <form id="form1">
      <div data-ng-app="divid" data-ng-controller="expressionController">
        <input type="number" ng-model="amount">
          <br/>
          default currency symbol ($): <span>{{amount | currency}}</span><br>
            <!--By default its $ sign-->
            no fractions: <span>{{amount | currency:"Currency Symbol  "}}</span><br>
              <!--Currency Symbol - Put your currency symbol -->
              no of fractions:<span>{{amount | currency:"Currency Symbol  ":1}}</span><br>
                <!-- :1 decimal place-->
                no of fractions:<span>{{amount | currency:"Currency Symbol  ":0}}</span><!-- :1 decimal place-->
                <!---->
              </div>
    </form>
  </body>

</html>


// Result


No comments:

Post a Comment

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...