Skip to content

Instantly share code, notes, and snippets.

@miguelbermudez
Created July 28, 2014 19:38
Show Gist options
  • Save miguelbermudez/955ca6c8fe88e0fd46f7 to your computer and use it in GitHub Desktop.
Save miguelbermudez/955ca6c8fe88e0fd46f7 to your computer and use it in GitHub Desktop.
Create Initials From String Filter
.filter('initials', function () {
var initialsFilter = function(input) {
if (input) {
var wordArr = input.split(' ');
var initials = wordArr.map(function(item) {
return item.substring(0,1).toUpperCase();
});
return initials.join('.');
}
};
return initialsFilter;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment