-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(ngRoute): extract path params containing hashes and/or question marks correctly #16670
Conversation
…arks correctly The `routeToRegExp` function introduced by 840b5f0 could not extract path params containing hashes and/or question marks from `$location.path()`. Since ngMock and ngRoute deal with different subjects (encoded url for ngMock and decoded path for ngRoute), this commit (re-)introduce separate function for each case.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
I signed it! |
CLAs look good, thanks! |
1 similar comment
CLAs look good, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR seems to unnecessarily revert a large part of 840b5f0. Can you please only make the necessary changes and leave the rest untouched.
…thRegExp` and `parseRoute`
@gkalpak Thanks for your review! Anyway, I fixed it! |
Awesome, thx!
I know, but they have almost the same logic, so it makes sense to share (see #14173 (comment)). |
Merged as 510404e |
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
This PR fixes a regression introduced by 840b5f0.
What is the current behavior? (You can also link to an open issue here)
If the path (
$location.path()
) contains hashes and/or question marks, path params are not correctly extracted.For example, if you set
$routeProvider.when('/foo/:bar', {})
and navigate to/foo/bar%23baz
, you will get$routeParams.bar === "bar"
, not$routeParams.bar === "bar#baz"
.What is the new behavior (if this is a feature change)?
Path params are correctly extracted (
$routeParams.bar === "bar#baz"
).Does this PR introduce a breaking change?
No.
Please check if the PR fulfills these requirements
Other information: