fix(router): do not require the creation of empty-path routes when no url left

Closes #12133
This commit is contained in:
vsavkin
2016-11-08 13:36:59 -08:00
committed by Victor Berchet
parent 2ced2a8a5a
commit 2c110931f8
5 changed files with 107 additions and 10 deletions

View File

@ -90,7 +90,16 @@ class Recognizer {
if (!(e instanceof NoMatch)) throw e;
}
}
throw new NoMatch();
if (this.noLeftoversInUrl(segmentGroup, segments, outlet)) {
return [];
} else {
throw new NoMatch();
}
}
private noLeftoversInUrl(segmentGroup: UrlSegmentGroup, segments: UrlSegment[], outlet: string):
boolean {
return segments.length === 0 && !segmentGroup.children[outlet];
}
processSegmentAgainstRoute(