Angularjs Examples

AJS Examples

AngularJS Number Filter

AngularJS number filter is allow you to format any number to specific string. If the input is not a number an empty string is returned. If the input is an infinite the Infinity symbol is returned.


{{ number_expression | number : fractionSize}}

AngularJS Number Filter Example

<title>My first AngularJS Number Format</title>
<script SRC="">
//Defining AngularJS Controller Using Standard Javascrip Object Constructor
function CustomerController($scope) {
   $scope.val = 65421.56789;
<div ng-app="">
<div ng-controller="CustomerController"> 
Enter number: <input ng-model='val'>
Default Number formatting: <span id='defaultNumber'>{{val | number}}</span><br> Without fractions: <span>{{val | number:0}}</span><br> Negative number: <span>{{-val | number:4}}</span> </div> </div> </body> </html>
See Live Example