autofocus on first field of creation

Signed-off-by: tykayn <15d65f2f-0b14-4f70-bf34-e130180ed62b@users.tedomum.net>
This commit is contained in:
tykayn 2021-11-08 11:20:07 +01:00
parent f4be6ed39d
commit 912e8af990

View File

@ -1,6 +1,7 @@
import { Component, Input, OnInit } from '@angular/core';
import { Component, Inject, Input, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { PollService } from '../../../../../core/services/poll.service';
import { DOCUMENT } from '@angular/common';
@Component({
selector: 'app-step-one',
@ -8,12 +9,18 @@ import { PollService } from '../../../../../core/services/poll.service';
styleUrls: ['./step-one.component.scss'],
})
export class StepOneComponent implements OnInit {
constructor(public pollService: PollService) {}
constructor(public pollService: PollService, @Inject(DOCUMENT) private document: any) {}
@Input()
step_max: any;
@Input()
form: FormGroup;
ngOnInit(): void {}
ngOnInit(): void {
const selector = '#title';
const firstField = this.document.querySelector(selector);
if (firstField) {
firstField.focus();
}
}
}