fix(router): fix url path for star segment in path recognizer
Url path of star segments should equal the original path. If you register the route `/app/*location` and invoke a url like `/app/foo/bar` the PathRecognizer should return a url path equal to the invoked url. Before this patch, everything after `foo` was ignored, which resulted in a redirect to `/app/foo` which was probably not intended (at least in the angular 1.5 component router). Closes #6976
This commit is contained in:
@ -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)) {
|
||||
|
Reference in New Issue
Block a user