aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main/angular/autofocus.directive.ts
blob: 5f087d79d1b09f0349becb2cbcfa449bcc3e48f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
import { AfterViewInit, Directive, ElementRef } from '@angular/core'

@Directive({
  selector: '[autofocus]'
})
export class AutofocusDirective implements AfterViewInit {
  constructor (private host: ElementRef) { }

  ngAfterViewInit () {
    this.host.nativeElement.focus()
  }
}