angular/angular.js — Issue #763: $location.update bug
Author: mikemap
Created: 2012-03-02 04:58:59+00:00
State: open

Using angular-0.9.19.js

The current [documentation for $location.update](http://docs.angularjs.org/#!/api/angular.service.$location) indicates that it may be called with an object with hashPath set as an argument, i.e.

$location.update({hashPath: '/path', hashSearch: {a: 'b', x: true}});

This doesn't work because the composeHref function expects protocol, host, port and path to be set on the loc object; however, the location object extended on line 7055 only has update and updateHash methods on it (as defined on line 7005).

The result is that the URL gets updated to something like:
undefined://undefinedundefined#/hashpath

Either the documentation needs to be changed to indicate those fields are required, or they should be filled in automatically from the window.location object.

Additionally, I thought using $location.updateHash('/hashpath') would work, but it yields the same errant URL.