-
Notifications
You must be signed in to change notification settings - Fork 27.5k
$location.search() returns empty when query params are not preceded by hash #7239
Comments
Thank you kindly! |
… mode This fix causes LocationHashbangUrl#$$rewrite() to move a pre-hash query string to after the hash. This, in turn, causes urlResolve() to correctly parse the query string, and report the correct dictionary. Closes angular#7239
@nosideeffects feel free to try that out and see if it works for you. It took a lot of work to get it doing that without breaking it, so it feels very difficult to make this work right in all cases. |
… mode This fix causes LocationHashbangUrl#$$rewrite() to move a pre-hash query string to after the hash. This, in turn, causes urlResolve() to correctly parse the query string, and report the correct dictionary. Closes angular#7239
It still doesn't appear to work in our app without a preceding hash. I will add preceding hashes in our codebase for now. Thank you for your extremely quick response and hard work! |
It only works for hashbang mode (not html5 mode because iirc there was already a fix for html5 mode, but apparently not). However, there is a test verifying that it works without a hash |
What if the query params exist on page load? The following fails:
|
That's because you aren't calling $$rewrite --- but $$rewrite always gets called. |
Then I am confused by the behavior I am seeing.
|
There's a test case verifying that it works, you might be using the version of the patch from last night before that was added. Or you might be using html5Mode. Provide a reproduction so I can see for myself |
What I am saying is that I am currently using your patched build in our app, which I downloaded a little over an hour ago. The tests pass, but the $location service still doesn't behave as I would expect. |
I understand what you're saying, what I'm saying is, post a reproduction |
I've reproduced it myself, and I see what you're saying. It's because |
… mode This fix causes LocationHashbangUrl#$$rewrite() to move a pre-hash query string to after the hash. This, in turn, causes urlResolve() to correctly parse the query string, and report the correct dictionary. Closes angular#7239
Okay, fixed |
… mode This fix causes LocationHashbangUrl#$$rewrite() to move a pre-hash query string to after the hash. This, in turn, causes urlResolve() to correctly parse the query string, and report the correct dictionary. Closes angular#7239
… mode This fix causes LocationHashbangUrl#$$rewrite() to move a pre-hash query string to after the hash. This, in turn, causes urlResolve() to correctly parse the query string, and report the correct dictionary. BREAKING CHANGE Previously, LocationHashbangUrl would keep query parameters from the initial URL preceeding a hash symbol as part of the application base url. This is no longer the case, as it is desirable to parse these as part of the search query. To migrate, one should create special urls rather than relying on query string, for instance, if a base url was previously "http://server.com/base?ie=true", it would be adviseable to instead use "http://server.com/base/ie" as the base url. Closes #7239
Hurray! Thank you so much! |
Please take a look at this commit: 3d6dff4 We reverted a similar change in the past because of regressions and overall mismatch with the original design of the $location service. I realized that this change should however be accepted for the |
For those having this problem and needing a workaround now. You can use this to get the querystring parameter 'a':
|
…5mlMode This fix causes LocationHashbangInHtml5Url#$$rewrite() to move a pre-hash query string to after the hash. This, in turn, causes urlResolve() to correctly parse the query string, and report the correct dictionary. BREAKING CHANGE Previously, LocationHashbangInHtml5Url would keep query parameters from the initial URL preceeding a hash symbol as part of the application base url. This is no longer the case, as it is desirable to parse these as part of the search query. To migrate, one should create special urls rather than relying on query string, for instance, if a base url was previously "http://server.com/base?ie=true", it would be adviseable to instead use "http://server.com/base/ie" as the base url. Closes angular#7239
…5mlMode This fix causes LocationHashbangInHtml5Url#$$rewrite() to move a pre-hash query string to after the hash. This, in turn, causes urlResolve() to correctly parse the query string, and report the correct dictionary. BREAKING CHANGE Previously, LocationHashbangInHtml5Url would keep query parameters from the initial URL preceeding a hash symbol as part of the application base url. This is no longer the case, as it is desirable to parse these as part of the search query. To migrate, one should create special urls rather than relying on query string, for instance, if a base url was previously "http://server.com/base?ie=true", it would be adviseable to instead use "http://server.com/base/ie" as the base url. Closes angular#7239
…5mlMode This fix causes LocationHashbangInHtml5Url#$$rewrite() to move a pre-hash query string to after the hash. This, in turn, causes urlResolve() to correctly parse the query string, and report the correct dictionary. BREAKING CHANGE Previously, LocationHashbangInHtml5Url would keep query parameters from the initial URL preceeding a hash symbol as part of the application base url. This is no longer the case, as it is desirable to parse these as part of the search query. To migrate, one should create special urls rather than relying on query string, for instance, if a base url was previously "http://server.com/base?ie=true", it would be adviseable to instead use "http://server.com/base/ie" as the base url. Closes angular#7239
…5mlMode This fix causes LocationHashbangInHtml5Url#$$rewrite() to move a pre-hash query string to after the hash. This, in turn, causes urlResolve() to correctly parse the query string, and report the correct dictionary. BREAKING CHANGE Previously, LocationHashbangInHtml5Url would keep query parameters from the initial URL preceeding a hash symbol as part of the application base url. This is no longer the case, as it is desirable to parse these as part of the search query. To migrate, one should create special urls rather than relying on query string, for instance, if a base url was previously "http://server.com/base?ie=true", it would be adviseable to instead use "http://server.com/base/ie" as the base url. Closes angular#7239
…5mlMode This fix causes LocationHashbangInHtml5Url#$$rewrite() to move a pre-hash query string to after the hash. This, in turn, causes urlResolve() to correctly parse the query string, and report the correct dictionary. BREAKING CHANGE Previously, LocationHashbangInHtml5Url would keep query parameters from the initial URL preceeding a hash symbol as part of the application base url. This is no longer the case, as it is desirable to parse these as part of the search query. To migrate, one should create special urls rather than relying on query string, for instance, if a base url was previously "http://server.com/base?ie=true", it would be adviseable to instead use "http://server.com/base/ie" as the base url. Closes angular#7239
…5mlMode This fix causes LocationHashbangInHtml5Url#$$rewrite() to move a pre-hash query string to after the hash. This, in turn, causes urlResolve() to correctly parse the query string, and report the correct dictionary. BREAKING CHANGE Previously, LocationHashbangInHtml5Url would keep query parameters from the initial URL preceeding a hash symbol as part of the application base url. This is no longer the case, as it is desirable to parse these as part of the search query. To migrate, one should create special urls rather than relying on query string, for instance, if a base url was previously "http://server.com/base?ie=true", it would be adviseable to instead use "http://server.com/base/ie" as the base url. Closes angular#7239
sorry about the commit spam ^-^ |
Thank you! |
this still happens in angular 1.3
|
Has this gone into 1.3? If not should we expect it? When? |
still happens in 1.3.4 (html5mode) |
still happens in 1.3.5 (html5mode) |
This seems to work in 1.3.8 with html5mode. |
for me, still happens in 1.3.14 (html5mode) |
The twitter Oauth call-back inserts a token and verifier in the URL before calling, so www.url.com/index.html#/callback becomes www.url.com/index.html?token=abc&verifier=xyz#/callback What I'd like is: $location.search() === {token: "abc", verifier:"xyz"} what I get is $location.search() === {} I assume this is the same problem. |
still has the issue in 1.3.15 +10086 |
+1 still have issue in 1.3.16 When |
for workaround add configuration for module .config(($locationProvider) -> |
I'm still having this problem in v1.4.7. @reg1sek 's workaround worked for me. |
The text was updated successfully, but these errors were encountered: