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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -