Hello,

I came across this question at Stackoverflow and i noticed the next usage:

this.renderer.setElementProperty(this.el.nativeElement, 'innerHTML', 
this.replace(this.text, search));


I have two questions:

   1. Is it the best practice to manipulate inner html by setting the 
   property *innerHTML *directly? ( I know in the example code, Renderer 
   and not Renderer2 is used but it doesn't change the approach)
   2. If I created element like this:
    let p = this.renderer.createElement( 'p')
   
   const text = this.renderer.createText('I am a text and i want to color the 
last word only');
   this.renderer.appendChild(p, text);
   
   And then I want to change the style of part of the text(The last word in 
   this example). should I manipulate the innerHTML or there is a best 
   practice to do so?

-- 
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