Created
December 7, 2015 10:56
-
-
Save jberndsen/ecfff558fe618a43ce21 to your computer and use it in GitHub Desktop.
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('dutchmoney', function () { | |
return function(input) { | |
var result = roundToTwo(parseFloat(input) + 'e+2').toFixed(2).replace('.', ','); | |
return isNaN(result) ? "" : result; | |
}; | |
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