Should $location extract search params from before the #! ? #5964
Description
When not in HTML5 mode, given a URL like this:
http://foo.com/?bar=baz
$location.search()
produces an empty object, rather than { bar: 'baz' }
.
I understand that it's looking only at the part of the URL following #!
, but I'm wondering if that's really the correct way to go - it certainly makes it difficult to extract and use those query parameters (without using separate URL parsing code for window.location
). Is this just not what $location
is for? The docs say:
The $location service parses the URL in the browser address bar (based on the window.location) and makes the URL available to your application." which suggests it should parse the whole URL.
I'd also expect that given a URL like this, not in HTML5 mode:
http://foo.com/?bar=baz#!/?qux=quux
I'd expect $location.search()
to be { bar: 'baz', qux: 'quux' }
- the merged set of query parameters.