Last year I wrote an in depth article on how to conditionally style Angular components:
The article walks through different kind of possibilities Angular offers and helps decide which approach might be the best for your current scenario or use case.
This Egghead course “Understand How to Style Angular Components can be seen as a natural extension of that article. It should give you a complete overview of everything related to styling Angular components.
In 10 lessons we will take a look at how to..
- Add styles to an Angular component
- Use Angular style encapsulation to avoid styles from leaking into other components
- Style HTML elements in Angular using the style property
- Conditionally add a single CSS class to a DOM element in Angular
- Style HTML elements in Angular using ngClass
- Style HTML elements in Angular using ngStyle
- Use Angular style sanitization to mark dynamic styles as trusted values
- Use Angular’s @HostBinding and :host(…) to add styling to the component itself
- Use :host-context and the /deep/ selector to apply context-based styling
- Use the Renderer2 to add styles to an element in Angular
Enjoy the course and definitely let me know how you liked it or whether there is some more stuff you’d like to see in this specific course. Thanks