Capitalize title in AngularJS -
i'm trying capitalize title isn't seem working. manage other words using css "capitalize" can't head around make work angularjs title.
this angularjs code:
<title ng-bind="title"></title>
this html output:
<title ng-bind="title" class="ng-binding">james byrne</title>
i want capitalize both j b.
you can use custom filter
<title ng-bind="(title| makecaps)"></title> app.filter('makecaps',function(){ return function(input){ var capsinput = input.split(' '), newinput = []; angular.foreach(capsinput,function(val,index){ newinput.push(val.substr(0,1).touppercase()+val.substr(1)); }); return newinput.join(' '); } });
Comments
Post a Comment