Why AngularJS currency filter formats negative numbers with parenthesis?

I know this is an old question, but the accepted answer is only answering why this happens, without a concrete solution to the problem. I think the “most correct way” of doing this, is to use a decorator like so:

angular
    .module('app')
    .config(['$provide', function($provide) {
        $provide.decorator('$locale', ['$delegate', function($delegate) {
          if($delegate.id == 'en-us') {
            $delegate.NUMBER_FORMATS.PATTERNS[1].negPre="-\u00A4";
            $delegate.NUMBER_FORMATS.PATTERNS[1].negSuf="";
          }
          return $delegate;
        }]);
      }]);

This is only called once, valid for any filter which depends on it, and you don’t need a custom filter for your currency formatting.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)