update title step of html page

This commit is contained in:
Tykayn 2021-12-17 12:19:32 +01:00 committed by tykayn
parent 48637c5d54
commit 4587d3eb52
3 changed files with 34 additions and 12 deletions

View File

@ -22,21 +22,21 @@ export class StepOneComponent implements OnInit {
public pollService: PollService,
@Inject(DOCUMENT) private document: any,
private router: Router,
private titleService: Title,
private confirmationService: ConfirmationService
private titleService: Title
) {
this.step_max = this.pollService.step_max;
this.titleService.setTitle(' Création de sondage - ' + environment.appTitle);
this.pollService.step_current = 1;
this.titleService.setTitle(
' Création de sondage - Étape ' +
this.pollService.step_current +
' sur ' +
this.pollService.step_max +
' ' +
environment.appTitle
);
}
ngOnInit(): void {
this.pollService.step_current = 1;
const selector = '#title';
const firstField = this.document.querySelector(selector);
if (firstField) {
firstField.focus();
}
}
ngOnInit(): void {}
leave(event: any) {
console.log('event', event);

View File

@ -1,6 +1,8 @@
import { Component, Input, OnInit } from '@angular/core';
import { PollService } from '../../../../../core/services/poll.service';
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
import { environment } from '../../../../../../environments/environment';
import { Title } from '@angular/platform-browser';
@Component({
selector: 'app-step-three',
@ -13,8 +15,17 @@ export class StepThreeComponent implements OnInit {
@Input()
form: any;
constructor(public pollService: PollService) {
constructor(public pollService: PollService, private titleService: Title) {
this.pollService.step_current = 3;
this.step_max = this.pollService.step_max;
this.titleService.setTitle(
' Création de sondage - Étape ' +
this.pollService.step_current +
' sur ' +
this.pollService.step_max +
' ' +
environment.appTitle
);
}
ngOnInit(): void {}

View File

@ -8,6 +8,8 @@ import { ToastService } from '../../../../../core/services/toast.service';
import { PollService } from '../../../../../core/services/poll.service';
import { DateUtilitiesService } from '../../../../../core/services/date.utilities.service';
import { ApiService } from '../../../../../core/services/api.service';
import { environment } from '../../../../../../environments/environment';
import { Title } from '@angular/platform-browser';
@Component({
selector: 'app-step-two',
@ -34,6 +36,7 @@ export class StepTwoComponent implements OnInit {
private toastService: ToastService,
public pollService: PollService,
private router: Router,
private titleService: Title,
public dateUtilities: DateUtilitiesService,
private apiService: ApiService,
@Inject(DOCUMENT) private document: any
@ -41,6 +44,14 @@ export class StepTwoComponent implements OnInit {
this.form = this.pollService.form;
this.pollService.step_current = 2;
this.step_max = this.pollService.step_max;
this.titleService.setTitle(
' Création de sondage - Étape ' +
this.pollService.step_current +
' sur ' +
this.pollService.step_max +
' ' +
environment.appTitle
);
}
get choices(): FormArray {