Created
November 20, 2015 12:15
-
-
Save jberndsen/e09fbe826e747fd43cfb to your computer and use it in GitHub Desktop.
Angular filter for displaying a number as dutch currency.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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