master
Boris Voropaev 2023-11-28 17:32:16 +03:00
parent 5c7de2cf5e
commit ddccbafc0a
1 changed files with 9 additions and 2 deletions

View File

@ -3,6 +3,9 @@ import {NavigationEnd, Router} from "@angular/router";
import {Subscription} from "rxjs";
import {PagesService} from "@app/_services/pages.service";
import {ListsService} from "@app/_services";
import {Title} from "@angular/platform-browser";
import { environment } from '@environments/environment';
@Component({
templateUrl: 'page.component.html',
@ -19,7 +22,8 @@ export class PageComponent {
constructor(
private router: Router,
private pagesService: PagesService,
private listsService: ListsService) {
private listsService: ListsService,
private titleService:Title){
this.routeSubscription = this.router.events.subscribe(event => {
if (event instanceof NavigationEnd) this.onNavigationEnd(event);
});
@ -74,7 +78,10 @@ export class PageComponent {
];
this.pagesService.find(this.url, {include: include.join(',')}).subscribe(res => {
this.page = res?.data;
if (this.page) this.pagesService.currentPage = this.page;
if (this.page) {
this.pagesService.currentPage = this.page;
this.titleService.setTitle(this.page.title||this.page.h1||this.page.name)
}
this.loading = false;
}, error => {
this.loading = false;