angularjs - How to display the second word first with dot -


i have issue display name in web site.

we clientusername(first , last name) in single string.

now want display first , last name first char dot.

if clientusername srirama reddy need display sriram r.

also, accept first name 12 characters

how can in angular

my controller code

    this.loadcurrentclientuserdetails = function () {     var clientuserdetails = common.getcurrentclient();     self.clientusername = clientuserdetails.username;     self.clientname = clientuserdetails.clientname;  }; 

you can use this

  var data=self.clientusername.split(' ');   var finalname=data[0].substring(0,12)+" "+data[1].substring(0,1)+"." 

this provide required data(also, accept first name 12 characters).


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -