diff --git a/modules/angular2/src/router/instruction.ts b/modules/angular2/src/router/instruction.ts index 198c54c27d..492b22bfe5 100644 --- a/modules/angular2/src/router/instruction.ts +++ b/modules/angular2/src/router/instruction.ts @@ -137,7 +137,7 @@ export function stringifyInstruction(instruction: Instruction): string { export function stringifyInstructionPath(instruction: Instruction): string { return instruction.component.urlPath + stringifyAux(instruction) + - stringifyPrimary(instruction.child); + stringifyPrimaryPrefixed(instruction.child); } export function stringifyInstructionQuery(instruction: Instruction): string { @@ -146,6 +146,14 @@ export function stringifyInstructionQuery(instruction: Instruction): string { ''; } +function stringifyPrimaryPrefixed(instruction: Instruction): string { + var primary = stringifyPrimary(instruction); + if (primary.length > 0) { + primary = '/' + primary; + } + return primary; +} + function stringifyPrimary(instruction: Instruction): string { if (isBlank(instruction)) { return ''; @@ -153,8 +161,8 @@ function stringifyPrimary(instruction: Instruction): string { var params = instruction.component.urlParams.length > 0 ? (';' + instruction.component.urlParams.join(';')) : ''; - return '/' + instruction.component.urlPath + params + stringifyAux(instruction) + - stringifyPrimary(instruction.child); + return instruction.component.urlPath + params + stringifyAux(instruction) + + stringifyPrimaryPrefixed(instruction.child); } function stringifyAux(instruction: Instruction): string {