From 7f199403b682fc7c01824093fdfa05cd1256911a Mon Sep 17 00:00:00 2001 From: jojohoch <joachim.hoch@iqb.hu-berlin.de> Date: Sat, 21 May 2022 16:39:10 +0200 Subject: [PATCH] [player] Fix ExpressionChangedAfterItHasBeenCheckedError - Error was raised when loading a second unit. It was caused by the binding of the UnitStateService to the UnitMenuComponent --- projects/player/src/app/components/unit/unit.component.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/player/src/app/components/unit/unit.component.ts b/projects/player/src/app/components/unit/unit.component.ts index 4dd8282e6..743e2f7ea 100644 --- a/projects/player/src/app/components/unit/unit.component.ts +++ b/projects/player/src/app/components/unit/unit.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { ChangeDetectorRef, Component, OnInit } from '@angular/core'; import { PlayerConfig, VopStartCommand } from 'player/modules/verona/models/verona'; import { Unit } from 'common/models/unit'; import { LogService } from 'player/modules/logging/services/log.service'; @@ -26,7 +26,8 @@ export class UnitComponent implements OnInit { private veronaPostService: VeronaPostService, private veronaSubscriptionService: VeronaSubscriptionService, private elementModelElementCodeMappingService: ElementModelElementCodeMappingService, - private sanitizationService: SanitizationService) { + private sanitizationService: SanitizationService, + private changeDetectorRef: ChangeDetectorRef) { } ngOnInit(): void { @@ -79,5 +80,6 @@ export class UnitComponent implements OnInit { private reset(): void { this.pages = []; this.playerConfig = null; + this.changeDetectorRef.detectChanges(); } } -- GitLab