问题
Dynamic components were loading absolutely fine in Angular 8. Once a component is loaded, Detach and Interest of components was also working fine. I am using ng-three-template.
loadComponent(componentID: number, component: any) {
this.viewContainerRef.detach();
if( this.componentFactory[componentID] == undefined ) {
this.componentFactory[componentID] = this.componentFactoryResolver.resolveComponentFactory( component );
this.componentRef[componentID] = this.viewContainerRef.createComponent( this.componentFactory[componentID] );
}
else {
this.viewContainerRef.insert( this.componentRef[componentID]._viewRef );
}
}
When I upgraded to Angular 9, component does get load, then detach, but don't Insert back again
Angular 8 console:
Angular 9 console:
Please help me with this issue, Thanks
来源:https://stackoverflow.com/questions/61809302/angular-9-isssue-with-dynamic-component-load