enum
Defines template and style encapsulation options available for Component's Component
.
enum ViewEncapsulation { Emulated: 0 None: 2 ShadowDom: 3 }
See encapsulation.
Further information is available in the Usage Notes...
Member | Description |
---|---|
Emulated: 0 | Emulate This is the default option. |
None: 2 | Don't provide any template or style encapsulation. |
ShadowDom: 3 | Use Shadow DOM to encapsulate styles. For the DOM this means using modern Shadow DOM and creating a ShadowRoot for Component's Host Element. |
@Component({ selector: 'app-root', template: ` <h1>Hello World!</h1> <span class="red">Shadow DOM Rocks!</span> `, styles: [` :host { display: block; border: 1px solid black; } h1 { color: blue; } .red { background-color: red; } `], encapsulation: ViewEncapsulation.ShadowDom }) class MyApp { }
© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v12.angular.io/api/core/ViewEncapsulation