aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCaitlin Potter2014-01-24 16:25:40 -0500
committerCaitlin Potter2014-02-21 18:31:13 -0500
commitcad717b1171affc3d540cea372576c70b0cb2295 (patch)
tree4c10aef63a229da36ff2b12be69ec964fd7b40b7 /src
parentc2d447e378dd72d1b955f476bd5bf249625b4dab (diff)
downloadangular.js-cad717b1171affc3d540cea372576c70b0cb2295.tar.bz2
fix($location): parse query string when path is empty in hashbang mode
Before this fix, search queries in hashbang mode were ignored if the hash was not present in the url. This patch corrects this by ensuring that the search query is available to be parsed by urlResolve when the hashbang is not present. Closes #5964
Diffstat (limited to 'src')
-rw-r--r--src/ng/location.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/ng/location.js b/src/ng/location.js
index 9bb4d417..85f780e2 100644
--- a/src/ng/location.js
+++ b/src/ng/location.js
@@ -178,6 +178,11 @@ function LocationHashbangUrl(appBase, hashPrefix) {
throw $locationMinErr('ihshprfx', 'Invalid url "{0}", missing hash prefix "{1}".', url,
hashPrefix);
}
+
+ if (withoutHashUrl === '' && withoutBaseUrl.charAt(0) === '?') {
+ withoutHashUrl = withoutBaseUrl;
+ }
+
parseAppUrl(withoutHashUrl, this, appBase);
this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase);
@@ -228,10 +233,14 @@ function LocationHashbangUrl(appBase, hashPrefix) {
*/
this.$$compose = function() {
var search = toKeyValue(this.$$search),
- hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
+ hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '',
+ url = '';
this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
- this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : '');
+ if (this.$$url) {
+ url = this.$$path ? hashPrefix + this.$$url : this.$$url;
+ }
+ this.$$absUrl = appBase + url;
};
this.$$rewrite = function(url) {