Files
bstlboard-front/src/app/material/autofocus.ts
T
2021-12-04 10:56:57 +01:00

17 lines
355 B
TypeScript

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();
})
}
}