Skip to content

ApplicationRef's onDestroy method should not be internal #49087

Closed
@edusperoni

Description

@edusperoni

Which @angular/* package(s) are relevant/related to the feature request?

core

Description

When developing with NgModules we were able to do:

const moduleRef = await platformBrowserDynamic().bootstrapModule(AppModule);
moduleRef.onDestroy(() => { /* some logic */ });

The new bootstrapApplication now returns a ApplicationRef. Although the onDestroy method exists in ApplicationRef, it's marked as internal and not exposed.

Proposed solution

Make ApplicationRef.onDestroy not internal and part of the public API. This makes sense as well because .destroy() and .destroyed are part of the public API.

Alternatives considered

(applicationRef as any).onDestroy(() => {});

or getting the reference to the first component and using its onDestroy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues related to the framework runtimecore: bootstrapfeatureIssue that requests a new featurefeature: in backlogFeature request for which voting has completed and is now in the backlogstate: has PR

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions