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.
Which @angular/* package(s) are relevant/related to the feature request?
core
Description
When developing with NgModules we were able to do:
The new
bootstrapApplicationnow returns aApplicationRef. Although theonDestroymethod exists inApplicationRef, it's marked as internal and not exposed.Proposed solution
Make
ApplicationRef.onDestroynot internal and part of the public API. This makes sense as well because.destroy()and.destroyedare part of the public API.Alternatives considered
or getting the reference to the first component and using its
onDestroy.