I am new to Angular, and am trying to use it to set focus on an input with the id \"input1\". I am using the following code:
component
import { Component, ElementRef, ViewChild, AfterViewInit} from '@angular/core'; ... @ViewChild('input1', {static: false}) inputEl:ElementRef; ngAfterViewInit() { setTimeout(() => this.inputEl.nativeElement.focus()); }
html