Skip to content

Instantly share code, notes, and snippets.

@fxck
Created September 11, 2013 17:20
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 fxck/6526848 to your computer and use it in GitHub Desktop.
Save fxck/6526848 to your computer and use it in GitHub Desktop.
currencyFilter.$inject = ['$locale'];
function currencyFilter($locale) {
var formats = $locale.NUMBER_FORMATS;
return function(amount, currencySymbol){
if (isUndefined(currencySymbol)) currencySymbol = formats.CURRENCY_SYM;
return formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, 2).
replace(/\u00A4/g, currencySymbol);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment