Skip to content

Commit e73fee7

Browse files
davidreherIgorMinar
authored andcommitted
fix(router): fixed the location wrapper for angular1
In angular2 `Location.path()` returns the complete path including query string. In angular1 the query parameters are missing. Similar to this `Location.go` does accept two parameters (path *and query*). Closes #6943
1 parent 72ab35b commit e73fee7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

modules/angular1_router/lib/facades.es5

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ Location.prototype.subscribe = function () {
303303
//TODO: implement
304304
};
305305
Location.prototype.path = function () {
306-
return $location.path();
306+
return $location.url();
307307
};
308-
Location.prototype.go = function (url) {
309-
return $location.path(url);
308+
Location.prototype.go = function (path, query) {
309+
return $location.url(path + query);
310310
};

modules/angular1_router/src/module_template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function routerFactory($q, $location, $$directiveIntrospector, $browser, $rootSc
5757
});
5858

5959
var router = new RootRouter(registry, location, $routerRootComponent);
60-
$rootScope.$watch(function () { return $location.path(); }, function (path) {
60+
$rootScope.$watch(function () { return $location.url(); }, function (path) {
6161
if (router.lastNavigationAttempt !== path) {
6262
router.navigateByUrl(path);
6363
}

0 commit comments

Comments
 (0)