Following the approach, you can use => 1. You can do this using the autoFoucs directive OR 2. Provide a link to your control, for example
<input hidden #firstName formcontrolname="firstName" type="text" class="form-control input-sm ng-pristine ng-valid ng-touched" placeholder="First Name" id="firstName">
Then in the ts file declare it as
export class App implements OnInit{ @ViewChild('firstName') firstNameTextbox; constructor() { } ngOnInit() { this.firstNameTextbox.nativeElement.focus(); } }
source share