From 23875cb330945788f2d290fd2063eb3d5c20e260 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 13 Jan 2011 15:32:13 -0800 Subject: significant rewrite of the $location service - don't update browser before and after eval instead - sync location properties before eval - sync location properties and update browser after eval - added tests - symplified the code - removed $location.toString() because it was not idempotent and useless This resolves the issue with issuing two $route.onHashChange calls when the $location was updated with a hashPath that needs to be encoded --- src/Browser.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/Browser.js') diff --git a/src/Browser.js b/src/Browser.js index eb6afb3c..671ec1cc 100644 --- a/src/Browser.js +++ b/src/Browser.js @@ -232,6 +232,7 @@ function Browser(window, document, body, XHR, $log) { * {@link angular.service.$location $location service} to monitor hash changes in angular apps. * * @param {function(event)} listener Listener function to be called when url hash changes. + * @return {function()} Returns the registered listener fn - handy if the fn is anonymous. */ self.onHashChange = function(listener) { if ('onhashchange' in window) { @@ -245,6 +246,7 @@ function Browser(window, document, body, XHR, $log) { } }); } + return listener; } ////////////////////////////////////////////////////////////// -- cgit v1.2.3