diff --git a/packages/angular/src/lib/cdk/detached-loader.ts b/packages/angular/src/lib/cdk/detached-loader.ts
index 31acb85..5574da5 100644
--- a/packages/angular/src/lib/cdk/detached-loader.ts
+++ b/packages/angular/src/lib/cdk/detached-loader.ts
@@ -16,7 +16,9 @@ registerElement('DetachedContainer', () => ProxyViewContainer, {
@Component({
// eslint-disable-next-line @angular-eslint/component-selector
selector: 'DetachedContainer',
- template: ``,
+ template: `
+
+ `,
})
// eslint-disable-next-line @angular-eslint/component-class-suffix
export class DetachedLoader implements OnDestroy {
@@ -33,7 +35,7 @@ export class DetachedLoader implements OnDestroy {
return new TemplatePortal(templateRef, this.vc, context);
}
- private loadInLocation(componentType: Type): ComponentRef {
+ private loadInAppRef(componentType: Type): ComponentRef {
const factory = this.resolver.resolveComponentFactory(componentType);
const componentRef = factory.create(this.containerRef.injector);
this.appRef.attachView(componentRef.hostView);
@@ -52,6 +54,10 @@ export class DetachedLoader implements OnDestroy {
return componentRef;
}
+ private loadInLocation(componentType: Type): ComponentRef {
+ return this.vc.createComponent(componentType);
+ }
+
public ngOnDestroy() {
this.disposeFunctions.forEach((fn) => fn());
}
@@ -65,14 +71,22 @@ export class DetachedLoader implements OnDestroy {
*/
public loadComponent(componentType: Type): Promise> {
Trace.write('DetachedLoader.loadComponent', 'detached-loader');
- return Promise.resolve(this.loadInLocation(componentType));
+ return Promise.resolve(this.loadInAppRef(componentType));
}
/**
* @deprecated use Portals
*/
public loadComponentSync(componentType: Type): ComponentRef {
- Trace.write('DetachedLoader.loadComponent', 'detached-loader');
+ Trace.write('DetachedLoader.loadComponentSync', 'detached-loader');
+ return this.loadInAppRef(componentType);
+ }
+
+ /**
+ * @deprecated use Portals
+ */
+ public loadComponentInLocation(componentType: Type): ComponentRef {
+ Trace.write('DetachedLoader.loadComponentInLocation', 'detached-loader');
return this.loadInLocation(componentType);
}
@@ -89,4 +103,11 @@ export class DetachedLoader implements OnDestroy {
});
return componentRef;
}
+
+ /**
+ * @deprecated use Portals
+ */
+ public loadWithFactoryInLocation(factory: ComponentFactory): ComponentRef {
+ return this.vc.createComponent(factory);
+ }
}
diff --git a/packages/angular/src/lib/legacy/router/page-router-outlet.ts b/packages/angular/src/lib/legacy/router/page-router-outlet.ts
index ce4ddc5..d3511cb 100644
--- a/packages/angular/src/lib/legacy/router/page-router-outlet.ts
+++ b/packages/angular/src/lib/legacy/router/page-router-outlet.ts
@@ -352,7 +352,7 @@ export class PageRouterOutlet implements OnDestroy, RouterOutletContract {
loaderRef.onDestroy(() => childInjector.destroy());
this.changeDetector.markForCheck();
- this.activated = loaderRef.instance.loadWithFactory(factory);
+ this.activated = loaderRef.instance.loadWithFactoryInLocation(factory);
this.activated.changeDetectorRef.detectChanges();
this.loadComponentInPage(page, this.activated, { activatedRoute });