fix(router): recognize child components with empty segments

Previosly, recognition ended when a parent captured all the parsed URL segments.
This caused routes that delegated from a parent to a child with an empty segment
to never be recognized.

Closes #4178
This commit is contained in:
Brian Ford
2015-09-14 11:22:54 -07:00
parent 63e785902f
commit 309944931f
3 changed files with 38 additions and 29 deletions

View File

@ -120,7 +120,7 @@ export class RouteRegistry {
private _recognizePrimaryRoute(parsedUrl: Url, parentComponent): Promise<PrimaryInstruction> {
var componentRecognizer = this._rules.get(parentComponent);
if (isBlank(componentRecognizer)) {
return PromiseWrapper.resolve(null);
return _resolveToNull;
}
// Matches some beginning part of the given URL
@ -137,12 +137,8 @@ export class RouteRegistry {
return instruction.resolveComponentType().then((componentType) => {
this.configFromComponent(componentType);
if (isBlank(partialMatch.remaining)) {
if (instruction.terminal) {
return new PrimaryInstruction(instruction, null, partialMatch.remainingAux);
} else {
return null;
}
if (instruction.terminal) {
return new PrimaryInstruction(instruction, null, partialMatch.remainingAux);
}
return this._recognizePrimaryRoute(partialMatch.remaining, componentType)