fix(router): removed unused ApplicationRef dependency (#35642)
As a part of the process of setting up Router providers, we use `ApplicationRef` as a dependency while providing `Router` token. The thing is that `ApplicationRef` is actually unused (all referenced were removed in 5a849829c4 (diff-c0baae5e1df628e1a217e8dc38557fcb)
), but it's still listed as dependency. This is causing problems in case `Router` is used as a dependency for factory functions provided as `APP_INITIALIZERS` multi-token (causing cyclic dependency). This commit removes unused `ApplicationRef` dependency in `Router`, so it can be used without causing cyclic dependency issue.
PR Close #35642
This commit is contained in:
parent
737ec52e9d
commit
c839c05620
|
@ -51,9 +51,9 @@ export const ROUTER_PROVIDERS: Provider[] = [
|
||||||
provide: Router,
|
provide: Router,
|
||||||
useFactory: setupRouter,
|
useFactory: setupRouter,
|
||||||
deps: [
|
deps: [
|
||||||
ApplicationRef, UrlSerializer, ChildrenOutletContexts, Location, Injector,
|
UrlSerializer, ChildrenOutletContexts, Location, Injector, NgModuleFactoryLoader, Compiler,
|
||||||
NgModuleFactoryLoader, Compiler, ROUTES, ROUTER_CONFIGURATION,
|
ROUTES, ROUTER_CONFIGURATION, [UrlHandlingStrategy, new Optional()],
|
||||||
[UrlHandlingStrategy, new Optional()], [RouteReuseStrategy, new Optional()]
|
[RouteReuseStrategy, new Optional()]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
ChildrenOutletContexts,
|
ChildrenOutletContexts,
|
||||||
|
@ -429,9 +429,9 @@ export interface ExtraOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setupRouter(
|
export function setupRouter(
|
||||||
ref: ApplicationRef, urlSerializer: UrlSerializer, contexts: ChildrenOutletContexts,
|
urlSerializer: UrlSerializer, contexts: ChildrenOutletContexts, location: Location,
|
||||||
location: Location, injector: Injector, loader: NgModuleFactoryLoader, compiler: Compiler,
|
injector: Injector, loader: NgModuleFactoryLoader, compiler: Compiler, config: Route[][],
|
||||||
config: Route[][], opts: ExtraOptions = {}, urlHandlingStrategy?: UrlHandlingStrategy,
|
opts: ExtraOptions = {}, urlHandlingStrategy?: UrlHandlingStrategy,
|
||||||
routeReuseStrategy?: RouteReuseStrategy) {
|
routeReuseStrategy?: RouteReuseStrategy) {
|
||||||
const router = new Router(
|
const router = new Router(
|
||||||
null, urlSerializer, contexts, location, injector, loader, compiler, flatten(config));
|
null, urlSerializer, contexts, location, injector, loader, compiler, flatten(config));
|
||||||
|
|
Loading…
Reference in New Issue