Created
March 20, 2015 18:54
-
-
Save bbrown/2001cfc45b6162f73046 to your computer and use it in GitHub Desktop.
Angular filter to format a 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("app").filter("percentage", ["$filter", function($filter) | |
{ | |
return function(input, decimals, alreadyConverted) | |
{ | |
var number = (alreadyConverted) ? input : input * 100; | |
return $filter("number")(number, decimals) + "%"; | |
}; | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment