diff --git a/modules/angular2/src/router/instruction.ts b/modules/angular2/src/router/instruction.ts index b2ebf8531c..bf55a8f3ab 100644 --- a/modules/angular2/src/router/instruction.ts +++ b/modules/angular2/src/router/instruction.ts @@ -160,7 +160,7 @@ export abstract class Instruction { // default instructions override these toLinkUrl(): string { return this.urlPath + this._stringifyAux() + - (isPresent(this.child) ? this.child._toLinkUrl() : ''); + (isPresent(this.child) ? this.child._toLinkUrl() : '') + this.toUrlQuery(); } // this is the non-root version (called recursively) diff --git a/modules/angular2/test/router/route_registry_spec.ts b/modules/angular2/test/router/route_registry_spec.ts index df9b9f2384..a204cf52a1 100644 --- a/modules/angular2/test/router/route_registry_spec.ts +++ b/modules/angular2/test/router/route_registry_spec.ts @@ -91,6 +91,15 @@ export function main() { expect(instruction.component.params).toEqual({}); }); + it('should generate URLs with extra params in the query', () => { + registry.config(RootHostCmp, + new Route({path: '/first/second', component: DummyCmpA, name: 'FirstCmp'})); + + var instruction = registry.generate(['FirstCmp', {a: 'one'}], []); + expect(instruction.toLinkUrl()).toEqual('first/second?a=one'); + }); + + it('should generate URLs of loaded components after they are loaded', inject([AsyncTestCompleter], (async) => { registry.config(