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

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

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