Skip to content

Commit

Permalink
fix(router): fixed the location wrapper for angular1
Browse files Browse the repository at this point in the history
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
  • Loading branch information
davidreher authored and IgorMinar committed Feb 9, 2016
1 parent 72ab35b commit e73fee7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions modules/angular1_router/lib/facades.es5
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ Location.prototype.subscribe = function () {
//TODO: implement
};
Location.prototype.path = function () {
return $location.path();
return $location.url();
};
Location.prototype.go = function (url) {
return $location.path(url);
Location.prototype.go = function (path, query) {
return $location.url(path + query);
};
2 changes: 1 addition & 1 deletion modules/angular1_router/src/module_template.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function routerFactory($q, $location, $$directiveIntrospector, $browser, $rootSc
});

var router = new RootRouter(registry, location, $routerRootComponent);
$rootScope.$watch(function () { return $location.path(); }, function (path) {
$rootScope.$watch(function () { return $location.url(); }, function (path) {
if (router.lastNavigationAttempt !== path) {
router.navigateByUrl(path);
}
Expand Down

0 comments on commit e73fee7

Please sign in to comment.