Answer : Use { static: true }  when you want to access the ViewChild  in ngOnInit .  Use { static: false }  will be accessible only in ngAfterViewInit . This is also what you want to do for when you have a structural directive ( *ngIf  etc.) in your template.  In most cases { static: false }  will work.    import { Component, OnInit, AfterViewInit, ViewChild, ElementRef } from '@angular/core';  @Component({   selector: 'example',   templateUrl: './example.component.html',   styleUrls: ['./example.component.scss'] }) export class ExampleComponent implements OnInit, AfterViewInit {   @ViewChild('elementA', { static: true }) elementStatic: ElementRef<HTMLElement>;   @ViewChild('elementB', { static: false }) elementDynamic: ElementRef<HTMLElement>;            public ngOnInit(): void   {     this.elementStatic.nativeElement; // Ok     this.elementDynamic.nativeElement; // ERROR TypeError: Cannot read property 'nativeElement...