Skip to content

Instantly share code, notes, and snippets.

@rabbishuki
Last active December 31, 2017 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rabbishuki/4fe5279553d5f1875194ea0bc92c3827 to your computer and use it in GitHub Desktop.
Save rabbishuki/4fe5279553d5f1875194ea0bc92c3827 to your computer and use it in GitHub Desktop.
An AngularJS Decorator to format negative numbers with the currency filter.
angular.module('app')
.config(function ($provide) {
$provide.decorator('$locale', function ($delegate) {
if ($delegate.id == 'en-us') {
$delegate.NUMBER_FORMATS.PATTERNS[1].negPre = '-\u00A4';
$delegate.NUMBER_FORMATS.PATTERNS[1].negSuf = '';
}
return $delegate;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment