Skip to content

Commit

Permalink
fix(router/instruction): ensure toLinkUrl includes extra params
Browse files Browse the repository at this point in the history
  • Loading branch information
petebacondarwin committed Mar 4, 2016
1 parent 6dce4f4 commit 6a23c1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/angular2/src/router/instruction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions modules/angular2/test/router/route_registry_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 6a23c1b

Please sign in to comment.