Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions modules/angular2/src/router/path_recognizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
9 changes: 9 additions & 0 deletions modules/angular2/test/router/path_recognizer_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
});
}