As I can see, it can be used as a replacement for <div> containers to style a component. Example:
Container use
@Component({ template: ` <div class="container"> <h1>Some Title</h1> <p>Some Content</h1> </div> `, styles: [` .container { border: 1px solid black; display: flex; } `], })
@Component({ template: ` <h1>Some Title</h1> <p>Some Content</h1> `, styles: [` :host { border: 1px solid black; display: flex; } `], })
If I understand correctly, these two solve the same problem. And it's nice to have one less element and class that you need to worry about in almost every single component.
Questions: what is :host ? If not, what is its essence and what are the best methods for providing style to your component besides adding containers all over the world?
Frigo source share