Skip to content

Instantly share code, notes, and snippets.

@NetanelBasal
Created October 24, 2020 16:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NetanelBasal/543beb8a3103e1b76790ca39d710305b to your computer and use it in GitHub Desktop.
Save NetanelBasal/543beb8a3103e1b76790ca39d710305b to your computer and use it in GitHub Desktop.
import { Directive, ElementRef } from '@angular/core';
@Directive({
selector: '[autofocus]'
})
export class AutofocusDirective {
constructor(private host: ElementRef) {}
ngAfterViewInit() {
this.host.nativeElement.focus();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment