Component composition in Angular2 — Part 1
Thierry Templier

Hi Thierry thank you for the great article. I’d like to ask for you’re opinion on something?

I’d like to implement a reusable directive based on the sub chapter “Changing styles of components”. Which would allow me to change the style of any component using the same directive.

My first idea was to add “@HostBinding” and an “@Input” for providing the class. Then you can easily apply the directive and pass the class to any element.

But i soon realized that i have no way of accessing the “:host” if i can’t inject my own “styles” or “stlyesUrl” and since the approach in your last post isn’t suggested by the Angular team, i’m stuck again.

Any idea is appreciated, thanks for your time.

Show your support

Clapping shows how much you appreciated Filip Lauc’s story.