15 lines
309 B
TypeScript
15 lines
309 B
TypeScript
|
import { Directive, AfterViewInit, ElementRef } from '@angular/core';
|
||
|
|
||
|
@Directive({
|
||
|
selector: '[appFocus]'
|
||
|
})
|
||
|
export class FocusDirective implements AfterViewInit {
|
||
|
|
||
|
constructor(private elementRef: ElementRef) { }
|
||
|
|
||
|
ngAfterViewInit(): void {
|
||
|
this.elementRef.nativeElement.focus();
|
||
|
}
|
||
|
|
||
|
}
|