MOBILE-3592 core: Fix ExpressionChanged in dynamic-component

main
Dani Palou 2020-12-14 09:56:44 +01:00
parent 1d77811be2
commit 167a0f552a
1 changed files with 3 additions and 1 deletions

View File

@ -75,7 +75,9 @@ export class CoreDynamicComponent implements OnChanges, DoCheck {
// Get the container where to put the dynamic component. // Get the container where to put the dynamic component.
@ViewChild('dynamicComponent', { read: ViewContainerRef }) set dynamicComponent(el: ViewContainerRef) { @ViewChild('dynamicComponent', { read: ViewContainerRef }) set dynamicComponent(el: ViewContainerRef) {
this.container = el; this.container = el;
this.createComponent();
// Use a timeout to avoid ExpressionChangedAfterItHasBeenCheckedError.
setTimeout(() => this.createComponent());
} }
instance?: any; // eslint-disable-line @typescript-eslint/no-explicit-any instance?: any; // eslint-disable-line @typescript-eslint/no-explicit-any