]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/shared-main/angular/autofocus.directive.ts
Merge branch 'feature/otp' into develop
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / angular / autofocus.directive.ts
1 import { AfterViewInit, Directive, ElementRef } from '@angular/core'
2
3 @Directive({
4 selector: '[myAutofocus]'
5 })
6 export class AutofocusDirective implements AfterViewInit {
7 constructor (private host: ElementRef) { }
8
9 ngAfterViewInit () {
10 const el = this.host.nativeElement as HTMLElement
11
12 el.focus({ preventScroll: true })
13 }
14 }