Angular, Server Side Rendering, Hydration, Static Site Generator, Ssr.
HTMLElement are not available on the server side since there’s no browser there. If you need to use those, you have to call that code in the brand-new afterRender and afterNextRender lifecycle methods as illustrated here: export class MyComponent { @ViewChild('content') contentRef: ElementRef;