From 7e47a2d016676f37287203f26689cce1ee1eaa0c Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Tue, 12 Oct 2010 05:31:32 +0800 Subject: temparary backaward compatibility patch for Controller.init - feedback relies on *Controller.init to be called when a Controller is being created. this with previous angular refactoring this is not happening in angular any more. To make it easier for feedback to transition, this change makes $become call controller's init method if present. - call to Controller.init from $route.updateRoute was removed. this was left there by accident during the previous refactoring. --- src/Scope.js | 5 +++++ src/services.js | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Scope.js b/src/Scope.js index 53228a0d..3aaff361 100644 --- a/src/Scope.js +++ b/src/Scope.js @@ -233,6 +233,11 @@ function createScope(parent, services, existing) { behavior[name] = bind(instance, fn); }); (Class || noop).call(instance); + + //TODO: backwards compatibility hack, remove when Feedback's init methods are removed + if (behavior.hasOwnProperty('init')) { + behavior.init(); + } } }); diff --git a/src/services.js b/src/services.js index 9bf3d1ed..41755962 100644 --- a/src/services.js +++ b/src/services.js @@ -253,7 +253,6 @@ angularService('$route', function(location){ angular.foreach(onChange, parentScope.$tryEval); if (childScope) { childScope.$become($route.current.controller); - parentScope.$tryEval(childScope.init); } } this.$watch(function(){return dirty + location.hash;}, updateRoute); -- cgit v1.2.3