Files
we_bstly-web/src/app/material/autofocus.ts
T
2025-05-11 18:05:06 +02:00

18 lines
376 B
TypeScript

import { Directive, ElementRef, OnInit } from '@angular/core';
@Directive({
standalone: false,
selector: '[matAutofocus]',
})
export class AutofocusDirective implements OnInit {
constructor(private element: ElementRef) { }
ngOnInit() {
setTimeout(() => {
this.element.nativeElement.focus();
this.element.nativeElement.scrollIntoView();
})
}
}