fix(router): don't prepend / unnecessarily to Location paths

Closes #6729
Closes #5502
This commit is contained in:
Alexander Bachmann
2016-01-27 21:05:34 +01:00
committed by Igor Minar
parent d86be245b8
commit c6036435f0
3 changed files with 36 additions and 2 deletions

View File

@ -438,7 +438,7 @@ export class RootRouter extends Router {
}
var emitPath = instruction.toUrlPath();
var emitQuery = instruction.toUrlQuery();
if (emitPath.length > 0) {
if (emitPath.length > 0 && emitPath[0] != '/') {
emitPath = '/' + emitPath;
}
@ -465,7 +465,7 @@ export class RootRouter extends Router {
commit(instruction: Instruction, _skipLocationChange: boolean = false): Promise<any> {
var emitPath = instruction.toUrlPath();
var emitQuery = instruction.toUrlQuery();
if (emitPath.length > 0) {
if (emitPath.length > 0 && emitPath[0] != '/') {
emitPath = '/' + emitPath;
}
var promise = super.commit(instruction);