Created
August 18, 2014 17:02
-
-
Save dahoba/68119dd3831805c6c809 to your computer and use it in GitHub Desktop.
Angularjs custom filter: Title Case
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('titlecase', function() { | |
return function(input, scope) { | |
var result =''; | |
if (input != null && input != undefined){ | |
var words = input.split(' '); | |
for(var i=0;i<words.length; i++){ | |
result = result.concat(words[i].substring(0,1).toUpperCase() + words[i].substring(1)+' '); | |
} | |
} | |
return result; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment