In Angular 8, ViewChild always takes 2 param, and second params always has static: true or static: false
You can try like this:
@ViewChild('nameInput', {static: false}) component
Also,the static: false
is going to be the default fallback behaviour in Angular 9.
What are static false/true: So as a rule of thumb you can go for the following:
{ static: true }
needs to be set when you want to access the
ViewChild in ngOnInit.
{ static: false }
can only be accessed in ngAfterViewInit. This is
also what you want to go for when you have a structural directive
(i.e. *ngIf) on your element in your template.