diff --git a/modules/@angular/router/src/create_url_tree.ts b/modules/@angular/router/src/create_url_tree.ts index b30b2591cc..31d226a3d4 100644 --- a/modules/@angular/router/src/create_url_tree.ts +++ b/modules/@angular/router/src/create_url_tree.ts @@ -5,14 +5,14 @@ import { RouterState, ActivatedRoute } from './router_state'; import { Params, PRIMARY_OUTLET } from './shared'; export function createUrlTree(route: ActivatedRoute, urlTree: UrlTree, commands: any[], - queryParameters: Params | undefined, fragment: string | undefined): UrlTree { + queryParams: Params | undefined, fragment: string | undefined): UrlTree { if (commands.length === 0) { - return tree(urlTree._root, urlTree, queryParameters, fragment); + return tree(urlTree._root, urlTree, queryParams, fragment); } const normalizedCommands = normalizeCommands(commands); if (navigateToRoot(normalizedCommands)) { - return tree(new TreeNode(urlTree.root, []), urlTree, queryParameters, fragment); + return tree(new TreeNode(urlTree.root, []), urlTree, queryParams, fragment); } const startingNode = findStartingNode(normalizedCommands, urlTree, route); @@ -21,11 +21,11 @@ export function createUrlTree(route: ActivatedRoute, urlTree: UrlTree, commands: []; const newRoot = constructNewTree(urlTree._root, startingNode, updated); - return tree(newRoot, urlTree, queryParameters, fragment); + return tree(newRoot, urlTree, queryParams, fragment); } -function tree(root: TreeNode, urlTree: UrlTree, queryParameters: Params | undefined, fragment: string | undefined): UrlTree { - const q = queryParameters ? stringify(queryParameters) : urlTree.queryParameters; +function tree(root: TreeNode, urlTree: UrlTree, queryParams: Params | undefined, fragment: string | undefined): UrlTree { + const q = queryParams ? stringify(queryParams) : urlTree.queryParams; const f = fragment ? fragment : urlTree.fragment; return new UrlTree(root, q, f); } diff --git a/modules/@angular/router/src/directives/router_link.ts b/modules/@angular/router/src/directives/router_link.ts index a64da76336..c117784f99 100644 --- a/modules/@angular/router/src/directives/router_link.ts +++ b/modules/@angular/router/src/directives/router_link.ts @@ -67,7 +67,7 @@ export class RouterLink implements OnChanges { if (!(typeof this.target === "string") || this.target == '_self') { this.router.navigate(this.commands, { relativeTo: this.route, - queryParameters: this.queryParams, + queryParams: this.queryParams, fragment: this.fragment }); return false; @@ -78,7 +78,7 @@ export class RouterLink implements OnChanges { private updateTargetUrlAndHref(): void { const tree = this.router.createUrlTree(this.commands, { relativeTo: this.route, - queryParameters: this.queryParams, + queryParams: this.queryParams, fragment: this.fragment }); if (tree) { diff --git a/modules/@angular/router/src/recognize.ts b/modules/@angular/router/src/recognize.ts index f875ffcbb7..cf2e820d35 100644 --- a/modules/@angular/router/src/recognize.ts +++ b/modules/@angular/router/src/recognize.ts @@ -13,7 +13,7 @@ export function recognize(rootComponentType: Type, config: RouterConfig, url: Ur try { const match = new MatchResult(rootComponentType, config, [url.root], {}, url._root.children, [], PRIMARY_OUTLET, null, url.root); const roots = constructActivatedRoute(match); - const res = new RouterStateSnapshot(roots[0], url.queryParameters, url.fragment); + const res = new RouterStateSnapshot(roots[0], url.queryParams, url.fragment); return new Observable(obs => { obs.next(res); obs.complete(); diff --git a/modules/@angular/router/src/router.ts b/modules/@angular/router/src/router.ts index da0df2a1b8..e31bcb70b8 100644 --- a/modules/@angular/router/src/router.ts +++ b/modules/@angular/router/src/router.ts @@ -24,7 +24,7 @@ import 'rxjs/add/operator/concatMap'; import {of} from 'rxjs/observable/of'; import {forkJoin} from 'rxjs/observable/forkJoin'; -export interface NavigationExtras { relativeTo?: ActivatedRoute; queryParameters?: Params; fragment?: string; } +export interface NavigationExtras { relativeTo?: ActivatedRoute; queryParams?: Params; fragment?: string; } /** * An event triggered when a navigation starts @@ -169,9 +169,9 @@ export class Router { * router.createUrlTree(['../../team/44/user/22'], {relativeTo: route}); * ``` */ - createUrlTree(commands: any[], {relativeTo, queryParameters, fragment}: NavigationExtras = {}): UrlTree { + createUrlTree(commands: any[], {relativeTo, queryParams, fragment}: NavigationExtras = {}): UrlTree { const a = relativeTo ? relativeTo : this.routerState.root; - return createUrlTree(a, this.currentUrlTree, commands, queryParameters, fragment); + return createUrlTree(a, this.currentUrlTree, commands, queryParams, fragment); } @@ -193,7 +193,7 @@ export class Router { navigate(commands: any[], extras: NavigationExtras = {}): Promise { return this.scheduleNavigation(this.createUrlTree(commands, extras), false); } - + /** * Serializes a {@link UrlTree} into a string. */ diff --git a/modules/@angular/router/src/url_serializer.ts b/modules/@angular/router/src/url_serializer.ts index 38cb8bb599..758ffea416 100644 --- a/modules/@angular/router/src/url_serializer.ts +++ b/modules/@angular/router/src/url_serializer.ts @@ -28,7 +28,7 @@ export class DefaultUrlSerializer implements UrlSerializer { serialize(tree: UrlTree): string { const node = serializeUrlTreeNode(tree._root); - const query = serializeQueryParams(tree.queryParameters); + const query = serializeQueryParams(tree.queryParams); const fragment = tree.fragment !== null ? `#${tree.fragment}` : ''; return `${node}${query}${fragment}`; } diff --git a/modules/@angular/router/src/url_tree.ts b/modules/@angular/router/src/url_tree.ts index 1837aff783..462173bded 100644 --- a/modules/@angular/router/src/url_tree.ts +++ b/modules/@angular/router/src/url_tree.ts @@ -13,7 +13,7 @@ export class UrlTree extends Tree { /** * @internal */ - constructor(root: TreeNode, public queryParameters: {[key: string]: string}, public fragment: string | null) { + constructor(root: TreeNode, public queryParams: {[key: string]: string}, public fragment: string | null) { super(root); } } diff --git a/modules/@angular/router/test/create_url_tree.spec.ts b/modules/@angular/router/test/create_url_tree.spec.ts index 8973180a49..8c1575651b 100644 --- a/modules/@angular/router/test/create_url_tree.spec.ts +++ b/modules/@angular/router/test/create_url_tree.spec.ts @@ -143,19 +143,19 @@ describe('createUrlTree', () => { it("should set query params", () => { const p = serializer.parse("/"); const t = create(p.root, p, [], {a: 'hey'}); - expect(t.queryParameters).toEqual({a: 'hey'}); + expect(t.queryParams).toEqual({a: 'hey'}); }); it("should stringify query params", () => { const p = serializer.parse("/"); const t = create(p.root, p, [], {a: 1}); - expect(t.queryParameters).toEqual({a: '1'}); + expect(t.queryParams).toEqual({a: '1'}); }); it("should reuse old query params when given undefined", () => { const p = serializer.parse("/?a=1"); const t = create(p.root, p, [], undefined); - expect(t.queryParameters).toEqual({a: '1'}); + expect(t.queryParams).toEqual({a: '1'}); }); it("should set fragment", () => { @@ -171,12 +171,12 @@ describe('createUrlTree', () => { }); }); -function create(start: UrlSegment | null, tree: UrlTree, commands: any[], queryParameters?: Params, fragment?: string) { +function create(start: UrlSegment | null, tree: UrlTree, commands: any[], queryParams?: Params, fragment?: string) { if (!start) { expect(start).toBeDefined(); } const s = new ActivatedRouteSnapshot([], {}, PRIMARY_OUTLET, "someComponent", null, start); const a = new ActivatedRoute(new BehaviorSubject(null), new BehaviorSubject(null), PRIMARY_OUTLET, "someComponent", s); advanceActivatedRoute(a); - return createUrlTree(a, tree, commands, queryParameters, fragment); + return createUrlTree(a, tree, commands, queryParams, fragment); } \ No newline at end of file diff --git a/modules/@angular/router/test/url_serializer.spec.ts b/modules/@angular/router/test/url_serializer.spec.ts index 6c695a0ee1..3c94bd0ef2 100644 --- a/modules/@angular/router/test/url_serializer.spec.ts +++ b/modules/@angular/router/test/url_serializer.spec.ts @@ -86,12 +86,12 @@ describe('url serializer', () => { it("should parse query params", () => { const tree = url.parse("/one?a=1&b=2"); - expect(tree.queryParameters).toEqual({a: '1', b: '2'}); + expect(tree.queryParams).toEqual({a: '1', b: '2'}); }); it("should parse key only query params", () => { const tree = url.parse("/one?a"); - expect(tree.queryParameters).toEqual({a: 'true'}); + expect(tree.queryParams).toEqual({a: 'true'}); }); it("should serializer query params", () => {