Skip to content

Instantly share code, notes, and snippets.

@southrop
Created January 15, 2015 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save southrop/9ae375492923a6a7d922 to your computer and use it in GitHub Desktop.
Save southrop/9ae375492923a6a7d922 to your computer and use it in GitHub Desktop.
Angular.js filter to display decimal numbers as percentage
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