Skip to content

Instantly share code, notes, and snippets.

@simon04
Created September 23, 2015 08:06
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 simon04/303f6b188a9d303215b9 to your computer and use it in GitHub Desktop.
Save simon04/303f6b188a9d303215b9 to your computer and use it in GitHub Desktop.
Angular: modify locale NUMBER_FORMATS for numberFilter
// https://github.com/angular/angular.js/pull/9160#issuecomment-68950547
// http://plnkr.co/edit/qvzXkQkVtTLHvHVYXTdU?p=preview
angular.module('foo', []).config(config);
function config($provide) {
$provide.decorator('numberFilter', function($delegate) {
$delegate.$stateful = true;
return $delegate;
});
$provide.decorator('$locale', function($delegate) {
$delegate.NUMBER_FORMATS.GROUP_SEP = ' ';
$delegate.NUMBER_FORMATS.PATTERNS.map(function(pattern) {
pattern.gSize = '4';
pattern.lgSize = '4';
});
return $delegate;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment