diff options
| author | Vojta Jina | 2011-11-29 21:51:59 -0800 |
|---|---|---|
| committer | Vojta Jina | 2012-01-23 11:05:36 -0800 |
| commit | 992c790f0786fa45c1cc3710f29bf49c7c322ba7 (patch) | |
| tree | 581d06ea9ba275a14d5891d83b2df03f9930bd45 /test/widgetsSpec.js | |
| parent | f5343c9fd3c7cd0fefdb4d71d2b579dbae998d6a (diff) | |
| download | angular.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 'test/widgetsSpec.js')
| -rw-r--r-- | test/widgetsSpec.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index f119174f..88d9e1b8 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -713,12 +713,12 @@ describe('widget', function() { $route.when('/foo', {controller: ParentCtrl, template: 'viewPartial.html'}); $rootScope.log = []; - function ParentCtrl() { - this.log.push('parent'); + function ParentCtrl($scope) { + $scope.log.push('parent'); } - $rootScope.ChildCtrl = function() { - this.log.push('child'); + $rootScope.ChildCtrl = function($scope) { + $scope.log.push('child'); }; $location.path('/foo'); |
