Created
October 24, 2020 16:57
-
-
Save NetanelBasal/543beb8a3103e1b76790ca39d710305b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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