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

Commit 5a4145f

Browse files
committed
revert: fix($location): return '/' for root path in hashbang mode
This reverts commit 63cd873. The change breaks existing tests of Google apps. The problem is that while we tried to avoid adding #/ to window.location.href unnecessarily we failed doing so. Likely because by setting $path, at some point (during a digest) we try to check if $location changed and we mistake the default '/' with an explicit settign of the path via the `path()` method. This results in us writing the url with '#/' into $browser.url() which updates the window.location by adding "#/" to the url - something we tried to avoid in the first place. I'll reopen PR #5712.
1 parent 039b990 commit 5a4145f

File tree

2 files changed

+0
-14
lines changed

2 files changed

+0
-14
lines changed

src/ng/location.js

-4
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,6 @@ function LocationHashbangUrl(appBase, hashPrefix) {
184184

185185
this.$$compose();
186186

187-
if (!this.$$path) {
188-
this.$$path = '/';
189-
}
190-
191187
/*
192188
* In Windows, on an anchor node on documents loaded from
193189
* the filesystem, the browser will return a pathname

test/ng/locationSpec.js

-10
Original file line numberDiff line numberDiff line change
@@ -1487,16 +1487,6 @@ describe('$location', function() {
14871487
expect(location.url()).toBe('/not-starting-with-slash');
14881488
expect(location.absUrl()).toBe('http://server/pre/index.html#/not-starting-with-slash');
14891489
});
1490-
1491-
1492-
it("should return / for path for the application root path", function() {
1493-
location = new LocationHashbangUrl('http://server/pre/index.html', '#');
1494-
location.$$parse('http://server/pre/index.html');
1495-
expect(location.path()).toBe('/');
1496-
1497-
location.$$parse('http://server/pre/');
1498-
expect(location.path()).toBe('/');
1499-
});
15001490
});
15011491

15021492

0 commit comments

Comments
 (0)