From 155777a92f6674950e51cea66c83dafbc1aaed6c Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Mon, 21 Sep 2020 10:14:11 -0300 Subject: [PATCH] fix(detached-loader): detach loadWithFactory --- nativescript-angular/common/detached-loader.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nativescript-angular/common/detached-loader.ts b/nativescript-angular/common/detached-loader.ts index b98fbb3b..2a433f7d 100644 --- a/nativescript-angular/common/detached-loader.ts +++ b/nativescript-angular/common/detached-loader.ts @@ -49,6 +49,13 @@ export class DetachedLoader implements OnDestroy { } public loadWithFactory(factory: ComponentFactory): ComponentRef { - return this.containerRef.createComponent(factory, this.containerRef.length, this.containerRef.injector, null); + const componentRef = factory.create(this.containerRef.injector); + this.appRef.attachView(componentRef.hostView); + + this.disposeFunctions.push(() => { + this.appRef.detachView(componentRef.hostView); + componentRef.destroy(); + }); + return componentRef; } } 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