Skip to content

Instantly share code, notes, and snippets.

@jberndsen
Created November 20, 2015 12:15
Show Gist options
  • Save jberndsen/e09fbe826e747fd43cfb to your computer and use it in GitHub Desktop.
Save jberndsen/e09fbe826e747fd43cfb to your computer and use it in GitHub Desktop.
Angular filter for displaying a number as dutch currency.
(function (angular) {
'use strict';
angular.module('app').filter('customnumber', function () {
return function (input) {
return roundToTwo(parseFloat(input) + "e+2").toFixed(2).replace('.', ',');
};
function roundToTwo(num) {
return +(Math.round(num) + "e-2");
}
});
})(angular);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment