Remove decimals from currency in AngularJS

AngularJS provides currency formatting filter which converts numbers into locale specific currency string e.g. 123.50 number converts to $123.00 for en-US locale or 123,50 € for fr-FR locale.

But what to do if I would like to perform currency formatting without the decimal (cent) part, e.g. $123 or 123 €?

For AngularJS 1.3+

For applications running on AngularJS 1.3+ the best approach is to use currency formatter with third parameter (fraction size) set to 0 (zero).

Example (JsFiddle demo ):

<p>{{10 | currency:undefined:0}}</p>

Please note that if you want to use default currency symbol provided by AngularJS library, the second parameter (currency symbol) needs to be undefined (null or empty value will not work as expected).

For AngularJS 1.2 and previous releases of the library

One of the solutions could be to format a number with existing Angular currency formatter and then get rid of trailing dot and two digits either with regular expressions or by trimming the string, e.g. "$123.00".slice(0, -3).

That solution would work perfectly fine but only for locales where the currency symbol is at the beginning of the string like en-US or en-GB. But what to do with locales (e.g., fr-FR) where the currency symbol appear at the end of the string?

I want something more robust working for all locales.

A way more robust approach, which works with all locales, is to remove a specific section of the formatted number. The easiest way to implement that is to create an AngularJS filter which performs number formatting and gets rid of decimal part.


angular.module('your-module', []).filter('mycurrency', [
  function ($filter, $locale) {
    var currency = $filter('currency'),
      formats = $locale.NUMBER_FORMATS
    return function (amount, symbol) {
      var value = currency(amount, symbol)
      return value.replace(new RegExp('\\' + formats.DECIMAL_SEP + '\\d{2}'), '')

Please note that the decimal separator can be either . (dot) or , (comma) and therefore we need to get that information form locale number formats variable.

Sine examples how that filter would work:


<div>{{myprice| mycurrency}}</div>


  • 10.25 (en-GB locale) -> £10
  • 20.00 (en-US locale) -> $20
  • -10.00 (en-us locale) -> ($10)
  • 30.00 (dk-DK locale) -> 30 kr.
  • -30.00 (dk-DK locale) -> -30 kr.

There are two demos for en-US and da-DK locales.

You can also check this Stack Overflow question for more suggestions.

You may also be interested in: