Improve this Doc  View Source


  1. - filter in module ng

Formats a number as text.

If the input is null or undefined, it will just be returned. If the input is infinite (Infinity or -Infinity), the Infinity symbol '∞' or '-∞' is returned, respectively. If the input is not a number an empty string is returned.


In HTML Template Binding

{{ number_expression | number : fractionSize}}

In JavaScript

$filter('number')(number, fractionSize)


Param Type Details
number numberstring

Number to format.


Number of decimal places to round the number to. If this is not provided then the fraction size is computed from the current locale's number formatting pattern. In the case of the default locale, it will be 3.



Number rounded to fractionSize appropriately formatted based on the current locale (e.g., in the en_US locale it will have "." as the decimal separator and include "," group separators after each third digit).


  angular.module('numberFilterExample', [])
    .controller('ExampleController', ['$scope', function($scope) {
      $scope.val = 1234.56789;
<div ng-controller="ExampleController">
  <label>Enter number: <input ng-model='val'></label><br>
  Default formatting: <span id='number-default'>{{val | number}}</span><br>
  No fractions: <span>{{val | number:0}}</span><br>
  Negative number: <span>{{-val | number:4}}</span>