//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