Closed
Description
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
.