Parses the browser location url and makes it available to your application. Any changes to the url are reflected into $location service and changes to $location are reflected to url. Notice that using browser's forward/back buttons changes the $location.
Update location object Does not immediately update the browser Browser is updated at the end of $eval()
href – {(string|Object)} –
Full href as a string or object with properties
scope.$location.update('http://www.angularjs.org/path#hash?search=x'); scope.$location.update({host: 'www.google.com', protocol: 'https'}); scope.$location.update({hashPath: '/path', hashSearch: {a: 'b', x: true}});
Update location hash part
path – {(string|Object)} –
A hashPath or hashSearch object
search(optional) – {Object} –
A hashSearch object
scope.$location.updateHash('/hp') ==> update({hashPath: '/hp'}) scope.$location.updateHash({a: true, b: 'val'}) ==> update({hashSearch: {a: true, b: 'val'}}) scope.$location.updateHash('/hp', {a: true}) ==> update({hashPath: '/hp', hashSearch: {a: true}})