Hi Dev,
Setting the focus from withing angular is the same as for native js.
@ViewChild("someTemplateVar") someTemplateVar: ElementRef;
someMethod(): void {
if (this.someTemplateVar.nativeElement) {
this.someTemplateVar.nativeElement.focus();
}
}
Wrapping inside the if makes sure you will not run into problems with SSR.
Regards
Sander
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/angular/7b75229a-34b7-44bf-b1b0-2f3d85e277dd%40googlegroups.com.