aboutsummaryrefslogtreecommitdiffstats
path: root/src/service/scope.js
diff options
context:
space:
mode:
authorVojta Jina2011-11-29 21:51:59 -0800
committerVojta Jina2012-01-23 11:05:36 -0800
commit992c790f0786fa45c1cc3710f29bf49c7c322ba7 (patch)
tree581d06ea9ba275a14d5891d83b2df03f9930bd45 /src/service/scope.js
parentf5343c9fd3c7cd0fefdb4d71d2b579dbae998d6a (diff)
downloadangular.js-992c790f0786fa45c1cc3710f29bf49c7c322ba7.tar.bz2
refactor(scope): separate controller from scope
Controller is standalone object, created using "new" operator, not messed up with scope anymore. Instead, related scope is injected as $scope. See design proposal: https://docs.google.com/document/pub?id=1SsgVj17ec6tnZEX3ugsvg0rVVR11wTso5Md-RdEmC0k Closes #321 Closes #425 Breaks controller methods are not exported to scope automatically Breaks Scope#$new() does not take controller as argument anymore
Diffstat (limited to 'src/service/scope.js')
-rw-r--r--src/service/scope.js19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/service/scope.js b/src/service/scope.js
index fe72c953..089e4a41 100644
--- a/src/service/scope.js
+++ b/src/service/scope.js
@@ -126,8 +126,9 @@ function $RootScopeProvider(){
* @function
*
* @description
- * Creates a new child {@link angular.module.ng.$rootScope.Scope scope}. The new scope can optionally behave as a
- * controller. The parent scope will propagate the {@link angular.module.ng.$rootScope.Scope#$digest $digest()} and
+ * Creates a new child {@link angular.module.ng.$rootScope.Scope scope}.
+ *
+ * The parent scope will propagate the {@link angular.module.ng.$rootScope.Scope#$digest $digest()} and
* {@link angular.module.ng.$rootScope.Scope#$digest $digest()} events. The scope can be removed from the scope
* hierarchy using {@link angular.module.ng.$rootScope.Scope#$destroy $destroy()}.
*
@@ -135,13 +136,10 @@ function $RootScopeProvider(){
* the scope and its child scopes to be permanently detached from the parent and thus stop
* participating in model change detection and listener notification by invoking.
*
- * @param {function()=} Class Constructor function which the scope should be applied to the scope.
- * @param {...*} curryArguments Any additional arguments which are curried into the constructor.
- * See {@link guide/dev_guide.di dependency injection}.
* @returns {Object} The newly created child scope.
*
*/
- $new: function(Class, curryArguments) {
+ $new: function() {
var Child = function() {}; // should be anonymous; This is so that when the minifier munges
// the name it does not become random set of chars. These will then show up as class
// name in the debugger.
@@ -161,15 +159,6 @@ function $RootScopeProvider(){
} else {
this.$$childHead = this.$$childTail = child;
}
- // short circuit if we have no class
- if (Class) {
- // can't use forEach, we need speed!
- var ClassPrototype = Class.prototype;
- for(var key in ClassPrototype) {
- child[key] = bind(child, ClassPrototype[key]);
- }
- $injector.invoke(Class, child, curryArguments);
- }
return child;
},