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.
This commit is contained in:
Igor Minar 2010-10-12 05:31:32 +08:00 committed by Misko Hevery
parent 3bd4abba6b
commit 7e47a2d016
2 changed files with 5 additions and 1 deletions

View file

@ -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();
}
}
});

View file

@ -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);