Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 1
    Can I do it using @HostBinding() by any chance? Commented Feb 15, 2017 at 23:41
  • 1
    Yet to try this, but the link was broken so: angular.io/api/core/Renderer#setElementProperty Commented Aug 24, 2017 at 2:53
  • Thanks, @theSiberman. I updated the answer to use your new link. Commented Aug 24, 2017 at 17:24
  • Adam: Is there a way to set an @Input property to the host using renderer2 ? set [(color)] property to the Host element. Commented Oct 20, 2017 at 15:29
  • 1
    Note in angular 5 it is now setAttribute using renderer 2: this.renderer2.setAttribute(element, 'name', data) Commented Feb 15, 2018 at 11:27