diff --git a/modules/@angular/router/src/create_url_tree.ts b/modules/@angular/router/src/create_url_tree.ts index d17067cb40..fae0b91e42 100644 --- a/modules/@angular/router/src/create_url_tree.ts +++ b/modules/@angular/router/src/create_url_tree.ts @@ -1,5 +1,5 @@ import { UrlTree, UrlSegment, equalUrlSegments } from './url_tree'; -import { TreeNode, rootNode } from './utils/tree'; +import { TreeNode } from './utils/tree'; import { forEach, shallowEqual } from './utils/collection'; import { RouterState, ActivatedRoute } from './router_state'; import { Params, PRIMARY_OUTLET } from './shared'; @@ -7,7 +7,7 @@ import { Params, PRIMARY_OUTLET } from './shared'; export function createUrlTree(route: ActivatedRoute, urlTree: UrlTree, commands: any[], queryParameters: Params | undefined, fragment: string | undefined): UrlTree { if (commands.length === 0) { - return tree(rootNode(urlTree), urlTree, queryParameters, fragment); + return tree(urlTree._root, urlTree, queryParameters, fragment); } const normalizedCommands = normalizeCommands(commands); @@ -19,7 +19,7 @@ export function createUrlTree(route: ActivatedRoute, urlTree: UrlTree, commands: const updated = normalizedCommands.commands.length > 0 ? updateMany(startingNode.children.slice(0), normalizedCommands.commands) : []; - const newRoot = constructNewTree(rootNode(urlTree), startingNode, updated); + const newRoot = constructNewTree(urlTree._root, startingNode, updated); return tree(newRoot, urlTree, queryParameters, fragment); } @@ -87,11 +87,11 @@ function normalizeCommands(commands: any[]): NormalizedNavigationCommands { function findStartingNode(normalizedChange: NormalizedNavigationCommands, urlTree: UrlTree, route: ActivatedRoute): TreeNode { if (normalizedChange.isAbsolute) { - return rootNode(urlTree); + return urlTree._root; } else { const urlSegment = findUrlSegment(route, urlTree, normalizedChange.numberOfDoubleDots); - return findMatchingNode(urlSegment, rootNode(urlTree)); + return findMatchingNode(urlSegment, urlTree._root); } } diff --git a/modules/@angular/router/src/url_serializer.ts b/modules/@angular/router/src/url_serializer.ts index bdc6755f29..38cb8bb599 100644 --- a/modules/@angular/router/src/url_serializer.ts +++ b/modules/@angular/router/src/url_serializer.ts @@ -1,6 +1,6 @@ import { UrlTree, UrlSegment } from './url_tree'; import { PRIMARY_OUTLET } from './shared'; -import { rootNode, TreeNode } from './utils/tree'; +import { TreeNode } from './utils/tree'; /** * Defines a way to serialize/deserialize a url tree. @@ -27,7 +27,7 @@ export class DefaultUrlSerializer implements UrlSerializer { } serialize(tree: UrlTree): string { - const node = serializeUrlTreeNode(rootNode(tree)); + const node = serializeUrlTreeNode(tree._root); const query = serializeQueryParams(tree.queryParameters); const fragment = tree.fragment !== null ? `#${tree.fragment}` : ''; return `${node}${query}${fragment}`; diff --git a/modules/@angular/router/src/utils/tree.ts b/modules/@angular/router/src/utils/tree.ts index 54aaa16c3d..8650902967 100644 --- a/modules/@angular/router/src/utils/tree.ts +++ b/modules/@angular/router/src/utils/tree.ts @@ -34,10 +34,6 @@ export class Tree { contains(tree: Tree): boolean { return contains(this._root, tree._root); } } -export function rootNode(tree: Tree): TreeNode { - return tree._root; -} - function findNode(expected: T, c: TreeNode): TreeNode | null { if (expected === c.value) return c; for (let cc of c.children) { diff --git a/modules/@angular/router/tsconfig.json b/modules/@angular/router/tsconfig.json index fcbab7c49f..7ac428001d 100644 --- a/modules/@angular/router/tsconfig.json +++ b/modules/@angular/router/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "experimentalDecorators": true, "emitDecoratorMetadata": true, + "noEmitOnError": false, "module": "commonjs", "target": "es5", "noImplicitAny": false, @@ -16,6 +17,8 @@ "src/index.ts", "src/router.ts", "src/recognize.ts", + "src/resolve.ts", + "src/create_router_state.ts", "src/router.ts", "src/config.ts", "src/router_outlet_map.ts", @@ -32,6 +35,7 @@ "test/utils/tree.spec.ts", "test/url_serializer.spec.ts", "test/recognize.spec.ts", + "test/create_router_state.spec.ts", "test/create_url_tree.spec.ts", "test/router.spec.ts", "typings/index.d.ts"