Hi,

Well, you can use the renderer2 to build the piece of html you need, by 
using its primitives. Thing is if you do manipulate the html directly, it 
will only work if it's in a browser. If you need to add server-side 
rendering, later on, this will fail there, creating a hard to trace issue.


const p = this.renderer.createElement( 'p')
const s = this.renderer.createElement( 'span')
this.renderer.setStyle(s,'backgroundcolor','yellow')

const text1 = this.renderer.createText('I am a text and i want to color the 
last word ');
const text2 = this.renderer.createText('only');

this.renderer.appendChild(p, text1);
this.renderer.appendChild(s, text2);
this.renderer.appendChild(p, s);

This will work in browser, but also in a webworker, or on the server. 

Regards
Sander

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to