diff --git a/modules/@angular/router-deprecated/src/rules/route_paths/param_route_path.ts b/modules/@angular/router-deprecated/src/rules/route_paths/param_route_path.ts index 2b7dc4afdf..e9e80154b4 100644 --- a/modules/@angular/router-deprecated/src/rules/route_paths/param_route_path.ts +++ b/modules/@angular/router-deprecated/src/rules/route_paths/param_route_path.ts @@ -111,10 +111,10 @@ export class ParamRoutePath implements RoutePath { for (var i = 0; i < this._segments.length; i += 1) { var pathSegment = this._segments[i]; - currentUrlSegment = nextUrlSegment; if (pathSegment instanceof ContinuationPathSegment) { break; } + currentUrlSegment = nextUrlSegment; if (isPresent(currentUrlSegment)) { // the star segment consumes all of the remaining URL, including matrix params diff --git a/modules/@angular/router-deprecated/test/route_registry_spec.ts b/modules/@angular/router-deprecated/test/route_registry_spec.ts index cd73c73b5c..e276da47dd 100644 --- a/modules/@angular/router-deprecated/test/route_registry_spec.ts +++ b/modules/@angular/router-deprecated/test/route_registry_spec.ts @@ -296,6 +296,22 @@ export function main() { }); })); + it('should match query params on the root component even when the next URL segment is null', + inject([AsyncTestCompleter], (async) => { + registry.config(RootHostCmp, + new Route({path: '/first/...', component: SingleSlashChildCmp})); + + registry.recognize('/first?comments=all', []) + .then((instruction) => { + expect(instruction.component.componentType).toBe(SingleSlashChildCmp); + expect(instruction.component.params).toEqual({'comments': 'all'}); + + expect(instruction.child.component.componentType).toBe(DummyCmpB); + expect(instruction.child.component.params).toEqual({}); + async.done(); + }); + })); + it('should generate URLs with matrix and query params', () => { registry.config( RootHostCmp,