Created
December 13, 2013 02:49
-
-
Save aaronpowell/7939159 to your computer and use it in GitHub Desktop.
AngularJS number directive that'll show whole numbers or round to the required number of decimal places
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
app.filter('numbersWithoutTrailingZero', function ($filter) { | |
return function (input, decimalPlaces) { | |
if (input % 1) { | |
return $filter('number')(input, decimalPlaces); | |
} | |
return $filter('number')(input, 0); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorted the problem I needed to solve. Thank you!