X Tutup
Skip to content

Commit 0d58b13

Browse files
petebacondarwinalexeagle
authored andcommitted
fix(router/instruction): ensure toLinkUrl includes extra params
Closes #7367
1 parent b5c769e commit 0d58b13

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

modules/angular2/src/router/instruction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export abstract class Instruction {
160160
// default instructions override these
161161
toLinkUrl(): string {
162162
return this.urlPath + this._stringifyAux() +
163-
(isPresent(this.child) ? this.child._toLinkUrl() : '');
163+
(isPresent(this.child) ? this.child._toLinkUrl() : '') + this.toUrlQuery();
164164
}
165165

166166
// this is the non-root version (called recursively)

modules/angular2/test/router/route_registry_spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@ export function main() {
9191
expect(instruction.component.params).toEqual({});
9292
});
9393

94+
it('should generate URLs with extra params in the query', () => {
95+
registry.config(RootHostCmp,
96+
new Route({path: '/first/second', component: DummyCmpA, name: 'FirstCmp'}));
97+
98+
var instruction = registry.generate(['FirstCmp', {a: 'one'}], []);
99+
expect(instruction.toLinkUrl()).toEqual('first/second?a=one');
100+
});
101+
102+
94103
it('should generate URLs of loaded components after they are loaded',
95104
inject([AsyncTestCompleter], (async) => {
96105
registry.config(

0 commit comments

Comments
 (0)
X Tutup