FIX: ExpressionChangedAfterItHasBeenCheckedError

This commit is contained in:
Patrick Haßel 2025-11-21 10:20:59 +01:00
parent 9f24ea08ae
commit b2a96e1c24
3 changed files with 13 additions and 4 deletions

View File

@ -26,8 +26,10 @@
<div class="MainMenuDrawer NoUserSelect" [hidden]="!showDrawer">
@for (location of locationList; track location.id) {
@if (location.id !== locationService.id) {
<div class="MainMenuItem" (click)="navigate(`Location/${location.id}`); showDrawer = false" routerLinkActive="MainMenuItemActive">{{ location.name }}</div>
}
}
</div>
<router-outlet/>

View File

@ -79,14 +79,13 @@ export class LocationDetail implements OnInit, OnDestroy {
}
ngOnInit(): void {
this.locationService.id = null;
this.subs.push(this.activatedRoute.params.subscribe(params => {
const id = paramNumberOrNull(params, "id");
if (id === null && this.configService.locationId !== null) {
this.router.navigate(["Location/" + this.configService.locationId]);
return;
}
this.locationService.id = id;
setTimeout(() => this.locationService.id = id, 0);
}));
this.subs.push(this.locationService.location$.subscribe(this.onLocationChange));
}

View File

@ -5,6 +5,14 @@ import {Injectable} from '@angular/core';
})
export class MenuService {
title: string = "";
private _title: string = "";
get title(): string {
return this._title;
}
set title(value: string) {
setTimeout(() => this._title = value, 0);
}
}