Angular Inline component css
Angular does provide support for inline css, probably not 100% as provided by specialized library like emotionjs or styled-components.
But essentially Angular does it throught ViewEncapsulation. 4 options supported which are :-
a) None - Css are placed in head section like normal css.
b) Native - Depending on your browser support, it tries to use ShadowDom if it can.
c) ShadowDom - uses browser shadow dom for component rendering.
d) Emulated - Css are placed in head section (and the names are awkward) and only accessible by component query selector.
How do you do it?
import { Component, ViewEncapsulation } from '@angular/core';
This is how you configure it on your angular components.
Pretty straight-forward. :)
Comments