FIX: ExpressionChangedAfterItHasBeenCheckedError
This commit is contained in:
parent
9f24ea08ae
commit
b2a96e1c24
@ -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/>
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user