/*
 * Squidex Headless CMS
 *
 * @license
 * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
 */

// tslint:disable: readonly-array

import { ChangeDetectionStrategy, Component, Input, OnChanges, OnDestroy } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { TitleService } from '@app/framework/internal';
import { Types } from '@app/shared';

@Component({
    selector: 'sqx-title[message]',
    template: '',
    changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TitleComponent implements OnDestroy, OnChanges {
    private previousIndex: undefined | number;

    @Input()
    public url: any[] = ['./'];

    @Input()
    public message: string;

    constructor(
        private readonly route: ActivatedRoute,
        private readonly router: Router,
        private readonly titleService: TitleService,
    ) {
    }

    public ngOnChanges() {
        const routeTree = this.router.createUrlTree(this.url, { relativeTo: this.route });
        const routeUrl = this.router.serializeUrl(routeTree);

        this.previousIndex = this.titleService.push(this.message, this.previousIndex, routeUrl);
    }

    public ngOnDestroy() {
        if (Types.isNumber(this.previousIndex)) {
            this.titleService.pop();
        }
    }
}

/*
 * Squidex Headless CMS
 *
 * @license
 * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
 */

// tslint:disable: readonly-array

import { ChangeDetectionStrategy, Component, Input, OnChanges, OnDestroy } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { TitleService, Types } from '@app/framework/internal';

@Component({
    selector: 'sqx-title[message]',
    template: '',
    changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TitleComponent implements OnDestroy, OnChanges {
    private previousIndex: undefined | number;

    @Input()
    public url: any[] = ['./'];

    @Input()
    public message: string;

    constructor(
        private readonly route: ActivatedRoute,
        private readonly router: Router,
        private readonly titleService: TitleService,
    ) {
    }

    public ngOnChanges() {
        const routeTree = this.router.createUrlTree(this.url, { relativeTo: this.route });
        const routeUrl = this.router.serializeUrl(routeTree);

        this.previousIndex = this.titleService.push(this.message, this.previousIndex, routeUrl);
    }

    public ngOnDestroy() {
        if (Types.isNumber(this.previousIndex)) {
            this.titleService.pop();
        }
    }
}

Fix build and circular dependency.
Fix build and circular dependency.
