Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1dca81b

Browse files
fix(detached-loader): detach loadWithFactory (#2260)
1 parent bcde284 commit 1dca81b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎nativescript-angular/common/detached-loader.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ export class DetachedLoader implements OnDestroy {
4949
}
5050

5151
public loadWithFactory<T>(factory: ComponentFactory<T>): ComponentRef<T> {
52-
return this.containerRef.createComponent(factory, this.containerRef.length, this.containerRef.injector, null);
52+
const componentRef = factory.create(this.containerRef.injector);
53+
this.appRef.attachView(componentRef.hostView);
54+
55+
this.disposeFunctions.push(() => {
56+
this.appRef.detachView(componentRef.hostView);
57+
componentRef.destroy();
58+
});
59+
return componentRef;
5360
}
5461
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /