UNPKG

angular-filter

Version:

Bunch of useful filters for angularJS(with no external dependencies!)

27 lines (25 loc) 448 B
/** * @ngdoc filter * @name ucfirst * @kind function * * @description * ucfirst */ angular.module('a8m.ucfirst', []) .filter({ ucfirst: ucfirstFilter, titleize: ucfirstFilter }); function ucfirstFilter() { return function (input) { return isString(input) ? input .split(' ') .map(function (ch) { return ch.charAt(0).toUpperCase() + ch.substring(1); }) .join(' ') : input; } }