From c839c056202fda1a7c7caa1c0646513c07b4be2f Mon Sep 17 00:00:00 2001 From: Andrew Kushnir Date: Sun, 23 Feb 2020 12:39:09 -0800 Subject: [PATCH] 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 https://github.com/angular/angular/commit/5a849829c42330d7e88e83e916e6e36380c97a97#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 --- packages/router/src/router_module.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/router/src/router_module.ts b/packages/router/src/router_module.ts index 8ac49b6429..62e755bca0 100644 --- a/packages/router/src/router_module.ts +++ b/packages/router/src/router_module.ts @@ -51,9 +51,9 @@ export const ROUTER_PROVIDERS: Provider[] = [ provide: Router, useFactory: setupRouter, deps: [ - ApplicationRef, UrlSerializer, ChildrenOutletContexts, Location, Injector, - NgModuleFactoryLoader, Compiler, ROUTES, ROUTER_CONFIGURATION, - [UrlHandlingStrategy, new Optional()], [RouteReuseStrategy, new Optional()] + UrlSerializer, ChildrenOutletContexts, Location, Injector, NgModuleFactoryLoader, Compiler, + ROUTES, ROUTER_CONFIGURATION, [UrlHandlingStrategy, new Optional()], + [RouteReuseStrategy, new Optional()] ] }, ChildrenOutletContexts, @@ -429,9 +429,9 @@ export interface ExtraOptions { } export function setupRouter( - ref: ApplicationRef, urlSerializer: UrlSerializer, contexts: ChildrenOutletContexts, - location: Location, injector: Injector, loader: NgModuleFactoryLoader, compiler: Compiler, - config: Route[][], opts: ExtraOptions = {}, urlHandlingStrategy?: UrlHandlingStrategy, + urlSerializer: UrlSerializer, contexts: ChildrenOutletContexts, location: Location, + injector: Injector, loader: NgModuleFactoryLoader, compiler: Compiler, config: Route[][], + opts: ExtraOptions = {}, urlHandlingStrategy?: UrlHandlingStrategy, routeReuseStrategy?: RouteReuseStrategy) { const router = new Router( null, urlSerializer, contexts, location, injector, loader, compiler, flatten(config));