aboutsummaryrefslogtreecommitdiffstats
path: root/src/Browser.js
diff options
context:
space:
mode:
authorIgor Minar2011-01-13 15:32:13 -0800
committerIgor Minar2011-01-13 16:58:35 -0800
commit23875cb330945788f2d290fd2063eb3d5c20e260 (patch)
tree0fe22574a0603ec80b4c012fa18766eb02951437 /src/Browser.js
parentb0be87f663e8684c1369e1bff740c1750ba17080 (diff)
downloadangular.js-23875cb330945788f2d290fd2063eb3d5c20e260.tar.bz2
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
Diffstat (limited to 'src/Browser.js')
-rw-r--r--src/Browser.js2
1 files changed, 2 insertions, 0 deletions
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;
}
//////////////////////////////////////////////////////////////