]>
Commit | Line | Data |
---|---|---|
1 | import { AfterViewInit, Directive, ElementRef } from '@angular/core' | |
2 | ||
3 | @Directive({ | |
4 | selector: '[autofocus]' | |
5 | }) | |
6 | export class AutofocusDirective implements AfterViewInit { | |
7 | constructor (private host: ElementRef) { } | |
8 | ||
9 | ngAfterViewInit () { | |
10 | this.host.nativeElement.focus() | |
11 | } | |
12 | } |