Skip to content

Commit 533d9da

Browse files
committed
fix!: remove deprecated ComponentFactory-based DetachedLoader methods
@angular/core 22 no longer exports ComponentFactory, so the deprecated loadWithFactory and loadWithFactoryInLocation methods (unused within the repo) are removed. Use the Type<T>-based loaders or Portals instead.
1 parent 0f8cc6b commit 533d9da

1 file changed

Lines changed: 1 addition & 22 deletions

File tree

packages/angular/src/lib/cdk/detached-loader.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ApplicationRef, ChangeDetectorRef, Component, ComponentFactory, ComponentRef, createComponent, inject, Injector, NO_ERRORS_SCHEMA, OnDestroy, TemplateRef, Type, ViewChild, ViewContainerRef, ChangeDetectionStrategy } from '@angular/core';
1+
import { ApplicationRef, ChangeDetectorRef, Component, ComponentRef, createComponent, inject, Injector, NO_ERRORS_SCHEMA, OnDestroy, TemplateRef, Type, ViewChild, ViewContainerRef, ChangeDetectionStrategy } from '@angular/core';
22
import { ProxyViewContainer, Trace } from '@nativescript/core';
33
import { registerElement } from '../element-registry';
44
import type { ComponentType } from '../utils/general';
@@ -96,25 +96,4 @@ export class DetachedLoader implements OnDestroy {
9696
Trace.write('DetachedLoader.loadComponentInLocation', 'detached-loader');
9797
return this.loadInLocation(componentType);
9898
}
99-
100-
/**
101-
* @deprecated use Portals
102-
*/
103-
public loadWithFactory<T>(factory: ComponentFactory<T>): ComponentRef<T> {
104-
const componentRef = factory.create(this.containerRef.injector);
105-
this.appRef.attachView(componentRef.hostView);
106-
107-
this.disposeFunctions.push(() => {
108-
this.appRef.detachView(componentRef.hostView);
109-
componentRef.destroy();
110-
});
111-
return componentRef;
112-
}
113-
114-
/**
115-
* @deprecated use Portals
116-
*/
117-
public loadWithFactoryInLocation<T>(factory: ComponentFactory<T>): ComponentRef<T> {
118-
return this.vc.createComponent(factory);
119-
}
12099
}

0 commit comments

Comments
 (0)