Skip to content

feat(DomPortalOutlet): Alternative constructor (ComponentFactoryResolver is deprecated) #24334

Closed
@bbarry

Description

@bbarry

Feature Description

@angular/angular deprecated ComponentFactoryResolver in 13.2.0:

https://github.com/angular/angular/blob/master/CHANGELOG.md#1320-2022-01-26

When using a lint rule such as deprecation/deprecation users of DomPortalOutlet now get a warning due to the constructor requiring a ComponentFactoryResolver

Use Case

describe('DomPortalOutlet', () => {
let componentFactoryResolver: ComponentFactoryResolver;
let someViewContainerRef: ViewContainerRef;
let someInjector: Injector;
let someFixture: ComponentFixture<ArbitraryViewContainerRefComponent>;
let someDomElement: HTMLElement;
let host: DomPortalOutlet;
let injector: Injector;
let appRef: ApplicationRef;
let deps = [ComponentFactoryResolver, Injector, ApplicationRef];
beforeEach(inject(deps, (cfr: ComponentFactoryResolver, i: Injector, ar: ApplicationRef) => {
componentFactoryResolver = cfr;
injector = i;
appRef = ar;
}));

I am not sure if the tslint deprecation rule is enabled in this repository (it is not in tslint.json here) but I presume it would warn on the above tests.

It would be nice to not require an

    // eslint-disable-next-line deprecation/deprecation
    private componentFactoryResolver: ComponentFactoryResolver

in my code, and presumably the Angular team is planning on removing this at some point.

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/portalfeatureThis issue represents a new feature or feature request rather than a bug or bug fix

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions