import { Directive, ElementRef, AfterViewInit } from '@angular/core';

// tslint:disable-next-line: directive-selector
@Directive({ selector: 'input[focus]' })
export class FocusDirective implements AfterViewInit {
  constructor(private elementRef: ElementRef<HTMLInputElement>) {}

  ngAfterViewInit() {
    this.elementRef.nativeElement.focus();
  }
}
