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

@Directive({
  selector: '[matAutofocus]',
})
export class AutofocusDirective implements OnInit {

  constructor(private element: ElementRef) { }

  ngOnInit() {
    setTimeout(() => {
      this.element.nativeElement.focus();
      this.element.nativeElement.scrollIntoView();
    })
  }

}