From 167a0f552ae600670068f5297b1b6b897e7a84fe Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Mon, 14 Dec 2020 09:56:44 +0100 Subject: [PATCH] MOBILE-3592 core: Fix ExpressionChanged in dynamic-component --- src/core/components/dynamic-component/dynamic-component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/components/dynamic-component/dynamic-component.ts b/src/core/components/dynamic-component/dynamic-component.ts index 5ae5512ab..943ec0a4c 100644 --- a/src/core/components/dynamic-component/dynamic-component.ts +++ b/src/core/components/dynamic-component/dynamic-component.ts @@ -75,7 +75,9 @@ export class CoreDynamicComponent implements OnChanges, DoCheck { // Get the container where to put the dynamic component. @ViewChild('dynamicComponent', { read: ViewContainerRef }) set dynamicComponent(el: ViewContainerRef) { this.container = el; - this.createComponent(); + + // Use a timeout to avoid ExpressionChangedAfterItHasBeenCheckedError. + setTimeout(() => this.createComponent()); } instance?: any; // eslint-disable-line @typescript-eslint/no-explicit-any