Skip to content
Snippets Groups Projects
Commit 9146603b authored by jojohoch's avatar jojohoch
Browse files

Fix ExpressionChangedAfterItHasBeenCheckedError in ElementComponent

Move project detection of ElementComponent from AfterViewInit to
AfterContentChecked
parent 00b8fb8b
No related branches found
No related tags found
No related merge requests found
import {
AfterViewInit,
AfterContentChecked,
Directive, ElementRef
} from '@angular/core';
import { UIElement } from './models/uI-element';
@Directive()
export abstract class ElementComponent implements AfterViewInit {
export abstract class ElementComponent implements AfterContentChecked {
abstract elementModel: UIElement;
project!: 'player' | 'editor';
......@@ -15,7 +15,7 @@ export abstract class ElementComponent implements AfterViewInit {
return this.elementRef.nativeElement;
}
ngAfterViewInit(): void {
ngAfterContentChecked(): void {
this.project = this.elementRef.nativeElement.closest('app-element-container') ? 'player' : 'editor';
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment