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'; import { ConfirmationService } from 'primeng/api'; import { Router } from '@angular/router'; @Component({ selector: 'app-step-one', templateUrl: './step-one.component.html', styleUrls: ['./step-one.component.scss'], }) export class StepOneComponent implements OnInit { @Input() step_max: any; @Input() form: FormGroup; constructor( public pollService: PollService, @Inject(DOCUMENT) private document: any, private router: Router, private confirmationService: ConfirmationService ) {} ngOnInit(): void { this.pollService.step_current = 1; const selector = '#title'; const firstField = this.document.querySelector(selector); if (firstField) { firstField.focus(); } } cancelCreationDialog() { this.confirmationService.confirm({ message: 'Quitter la création de sondage?', accept: () => { this.router.navigate(['/']); }, }); } }