Created
January 15, 2015 10:31
-
-
Save southrop/9ae375492923a6a7d922 to your computer and use it in GitHub Desktop.
Angular.js filter to display decimal numbers as percentage
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
angular.module('myApp') | |
.filter('percentage', ['$filter', function ($filter) { | |
return function (input, decimalPlaces) { | |
return $filter('number')(input * 100, decimalPlaces) + '%'; | |
}; | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment