Skip to content

Commit

Permalink
fix(ng2.pushState): Properly match urls when base path set
Browse files Browse the repository at this point in the history
Closes #2745
  • Loading branch information
christopherthielen committed May 13, 2016
1 parent 835f81c commit b9be2dc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ng2/location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,20 @@ export class UIRouterLocation {
let locSt = this.locationStrategy;

if (this.isHashBang) {
loc.path = () =>
splitOnHash(splitOnQuestionMark(locSt.path())[0])[0];
loc.hash = () =>
splitOnHash(splitOnHash(this.platformLocation.hash)[1])[1];
} else {
let basepath = locSt.getBaseHref();
let basepathRegExp = new RegExp("^" + basepath);
let replace = (basepath[basepath.length - 1] === '/') ? "/" : "";
loc.path = () =>
splitOnHash(splitOnQuestionMark(locSt.path())[0])[0].replace(basepathRegExp, replace);
loc.hash = () =>
splitOnHash(this.platformLocation.hash)[1];
}

loc.path = () =>
splitOnHash(splitOnQuestionMark(locSt.path())[0])[0];

loc.search = () => {
let queryString = splitOnHash(splitOnQuestionMark(locSt.path())[1])[0];
Expand Down

0 comments on commit b9be2dc

Please sign in to comment.