Last active
April 7, 2016 01:49
-
-
Save jrobinsonc/7c5c3769775f34f4306e to your computer and use it in GitHub Desktop.
Angular filter: Capitalize words
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('mymodule').filter('ucwords', function() { | |
return function(input,arg) { | |
return input.replace(/(?:^|\s)\S/g, function(a) { return a.toUpperCase(); }); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment