withExperimentalAutoCleanupInjectors
Enables automatic destruction of unused route injectors.
API
function withExperimentalAutoCleanupInjectors(): ExperimentalAutoCleanupInjectorsFeature;
@returns
ExperimentalAutoCleanupInjectorsFeature
Description
When enabled, the router will automatically destroy EnvironmentInjectors associated with Routes that are no longer active or stored by the RouteReuseStrategy.
This feature is opt-in and requires RouteReuseStrategy.shouldDestroyInjector to return true for the routes that should be destroyed. If the RouteReuseStrategy uses stored handles, it should also implement retrieveStoredRouteHandles to ensure injectors for handles that will be reattached are not destroyed.
Super-powered by Google ©2010–2025.
Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.
https://angular.dev/api/router/withExperimentalAutoCleanupInjectors