You can use a decorator for this @ViewChild. The documentation is at https://angular.io/api/core/ViewChild .
Here plnkr works: http://plnkr.co/edit/KvUmkuVBVbtL1AxFvU3F
This code essence boils down to giving your input element a name and attaching the click event in your template.
<input #myInput />
<button (click)="focusInput()">Click</button>
@ViewChild @ViewChildren (), .
export class App implements AfterViewInit {
@ViewChild("myInput") inputEl: ElementRef;
focusInput() {
this.inputEl.nativeElement.focus()
}
, . ElementRef ,
, XSS (https://angular.io/api/core/ElementRef), .
, inputEl , ngAfterViewInit.