How do I focus on input, which is hidden first, but opens on the click of a button? The autofocus attribute only works the first time, and 'nativeElement' of undefined. On jQuery everything is simple, but I need to do without it.
<input type="text" *ngIf="isVisible" #test autofocus>
<button (click)="testAction()">Test</button>
@ViewChild('test') test: ElementRef;
isVisible = false;
testAction() {
this.isVisible = !this.isVisible;
this.test.nativeElement.focus();
}