Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix($route): correctly extract path params if path contains question mark or hash #16672

Closed
wants to merge 8 commits into from
Prev Previous commit
Next Next commit
refactor(ngRoute): do not unnecessarily return originalPath in `rou…
…teToRegExp`
  • Loading branch information
gkalpak committed Aug 25, 2018
commit 08c095a8e3c94e8316a73bfa55f948b356a4a9e4
3 changes: 2 additions & 1 deletion src/ngRoute/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ function $RouteProvider() {
}
routes[path] = angular.extend(
routeCopy,
{originalPath: path},
path && routeToRegExp(path, routeCopy)
);

Expand All @@ -235,7 +236,7 @@ function $RouteProvider() {
: path + '/';

routes[redirectPath] = angular.extend(
{redirectTo: path},
{originalPath: path, redirectTo: path},
routeToRegExp(redirectPath, routeCopy)
);
}
Expand Down
1 change: 0 additions & 1 deletion src/routeToRegExp.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ function routeToRegExp(pathOrUrl, opts) {
}

return {
originalPath: pathOrUrl,
keys: keys,
regexp: new RegExp(
'^' + pattern + '(?:[?#]|$)',
Expand Down