aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/route.js
diff options
context:
space:
mode:
authorMisko Hevery2012-05-22 16:45:56 -0700
committerMisko Hevery2012-06-02 15:44:58 -0700
commit92a2e1807657c69e1372106b0727675a30f4cbd7 (patch)
treef236f146b44c4a03cfc04e48e6dba878c74c6153 /src/ng/route.js
parent8aa18f0ad036fd4f2dc26f54d80754c70232b4f7 (diff)
downloadangular.js-92a2e1807657c69e1372106b0727675a30f4cbd7.tar.bz2
feat($location): add $locatonChange[begin|completed] event
This allows location change cancelation
Diffstat (limited to 'src/ng/route.js')
-rw-r--r--src/ng/route.js5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/ng/route.js b/src/ng/route.js
index 032e3716..ec05d1f8 100644
--- a/src/ng/route.js
+++ b/src/ng/route.js
@@ -286,7 +286,6 @@ function $RouteProvider(){
*/
var matcher = switchRouteMatcher,
- dirty = 0,
forceReload = false,
$route = {
routes: routes,
@@ -304,12 +303,12 @@ function $RouteProvider(){
* creates new scope, reinstantiates the controller.
*/
reload: function() {
- dirty++;
forceReload = true;
+ $rootScope.$evalAsync(updateRoute);
}
};
- $rootScope.$watch(function() { return dirty + $location.url(); }, updateRoute);
+ $rootScope.$on('$locationChangeSuccess', updateRoute);
return $route;