diff --git a/modules/angular2/src/router/path_recognizer.ts b/modules/angular2/src/router/path_recognizer.ts index 263ae9446d..36a1cd8887 100644 --- a/modules/angular2/src/router/path_recognizer.ts +++ b/modules/angular2/src/router/path_recognizer.ts @@ -208,15 +208,16 @@ export class PathRecognizer { } if (isPresent(currentSegment)) { - captured.push(currentSegment.path); - // the star segment consumes all of the remaining URL, including matrix params if (segment instanceof StarSegment) { positionalParams[segment.name] = currentSegment.toString(); + captured.push(currentSegment.toString()); nextSegment = null; break; } + captured.push(currentSegment.path); + if (segment instanceof DynamicSegment) { positionalParams[segment.name] = currentSegment.path; } else if (!segment.match(currentSegment.path)) { diff --git a/modules/angular2/test/router/path_recognizer_spec.ts b/modules/angular2/test/router/path_recognizer_spec.ts index 08fddc1044..c0acfc59c7 100644 --- a/modules/angular2/test/router/path_recognizer_spec.ts +++ b/modules/angular2/test/router/path_recognizer_spec.ts @@ -90,5 +90,14 @@ export function main() { expect(match['allParams']).toEqual({'c': '3'}); }); }); + + describe('wildcard segment', () => { + it('should return a url path which matches the original url path', () => { + var rec = new PathRecognizer('/wild/*everything'); + var url = parser.parse('/wild/super;variable=value/anotherPartAfterSlash'); + var match = rec.recognize(url); + expect(match['urlPath']).toEqual('wild/super;variable=value/anotherPartAfterSlash'); + }); + }); }); }