Shadow DOM
In fact, Angular doesn’t use native Shadow DOM by default, it uses an emulation. Most browsers simply don’t support Shadow DOM yet, but we should still be able to use the framework. Even better, we can easily tell Angular to use the native Shadow DOM if we want, View Encapsulation in Angular.
View Encapsulation Types
Angular comes with view encapsulation built in, which enables us to use Shadow DOM or even emulate it. There are three view encapsulation types:
- ViewEncapsulation.None - No Shadow DOM at all. Therefore, also no style encapsulation.
- ViewEncapsulation.Emulated - No Shadow DOM but style encapsulation emulation.
- ViewEncapsulation.Native - Native Shadow DOM with all it’s goodness.
To make that Angular doesn’t use Shadow DOM at all. In case adding some attributes to the style so that the style is not rendered well in the browser.import {Component, OnInit, ViewEncapsulation} from '@angular/core';
@Component({
selector: 'app-period',
templateUrl: './period.component.html',
encapsulation: ViewEncapsulation.None,
styleUrls: ['./period.component.scss']
})