<body> and <head> tag can be get in Angular component by injectingDOCUMENT, like this:
import { DOCUMENT } from '@angular/common';
import { Inject } from '@angular/core';
export class TestComponent {
constructor(
@Inject(DOCUMENT) private document: Document
)
// get <head>
// this.document.head
// get <body>
// this.document.body
}
But is it possible to get <html> tag in Angular component?
document.documentElement?<html>. But add these attributes directly on<html>in the rootindex.htmlwill take effect globally. Setencapsulation: ViewEncapsulation.Nonein specific component to ignore the shadow dom maybe a compromise way, but it will affect all the "none encapusulation" components, which I don't want either.