Skip to main content

What types of ViewEncapsulation exist?

In Angular, there are three types of ViewEncapsulation that determine a component's style isolation:

  1. Emulated - the default mode. Angular adds special attributes to elements and styles to simulate isolation. The component's styles apply only inside it, but the browser still sees regular CSS.
  2. None - the component's styles become global. They apply to all elements of the application, there is no isolation.
  3. ShadowDom - uses the browser's native Shadow DOM. Styles are fully isolated inside the component and do not affect other parts of the application.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.