javascript - Hide part of the text returned from the server -


on webpage want hide part of text in object returned server.for example:

<div>     <h4>{{name.subname}}</h4> </div>   

the string returned {{name.subname}} contains name followed text within brackets, "sample name(xyz)". want able hide appearing within brackets i.e. (xyz) in case. suggestions on how can make work?

upon returning server, add function object returns intended format,

$.get('example', function(name){     name.cleansubname = function(){         this.subname.replace(/\([^)]+\)/, "")     } }); 

and use in template like,

<h4>{{name.cleansubname()}}</h4> 

regex borrowed @rohan kumar :)

hope helps.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -