> {
const factory = this.resolver.resolveComponentFactory(componentType);
- const componentRef = this.containerRef.createComponent(factory, this.containerRef.length, this.containerRef.injector);
+ const componentRef = factory.create(this.containerRef.injector);
+ this.appRef.attachView(componentRef.hostView);
+
+ this.disposeFunctions.push(() => {
+ this.appRef.detachView(componentRef.hostView);
+ componentRef.destroy();
+ });
// Component is created, built may not be checked if we are loading
// inside component with OnPush CD strategy. Mark us for check to be sure CD will reach us.
@@ -27,6 +34,10 @@ export class DetachedLoader {
return Promise.resolve(componentRef);
}
+ public ngOnDestroy() {
+ this.disposeFunctions.forEach((fn) => fn());
+ }
+
public detectChanges() {
this.changeDetector.markForCheck();
}
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy