From b2811e50c540f9747042e0001330f6fc8fe44a8c Mon Sep 17 00:00:00 2001 From: Jason Aden Date: Fri, 25 Jan 2019 10:41:58 -0800 Subject: [PATCH] refactor(router): initalize browserUrlTree to empty tree (#28376) The value here is unimportant on initialization since it's not looked at until the second navigation. However, sometimes in testing the `Location` service is mocked out, or the Router constructor manually called. Assuming `Location` exists in the constructor leads to test failures in `google3` therefore we initialize to a value that will not cause errors. PR Close #28376 --- packages/router/src/router.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/router/src/router.ts b/packages/router/src/router.ts index 3261f1efec..45312f8a68 100644 --- a/packages/router/src/router.ts +++ b/packages/router/src/router.ts @@ -401,7 +401,7 @@ export class Router { this.resetConfig(config); this.currentUrlTree = createEmptyUrlTree(); this.rawUrlTree = this.currentUrlTree; - this.browserUrlTree = this.parseUrl(this.location.path()); + this.browserUrlTree = this.currentUrlTree; this.configLoader = new RouterConfigLoader(loader, compiler, onLoadStart, onLoadEnd); this.routerState = createEmptyState(this.currentUrlTree, this.rootComponentType);