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 /docs/src/templates/docs.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 'docs/src/templates/docs.js')
| -rw-r--r-- | docs/src/templates/docs.js | 11 | 
1 files changed, 5 insertions, 6 deletions
| diff --git a/docs/src/templates/docs.js b/docs/src/templates/docs.js index 38a75236..bf279df5 100644 --- a/docs/src/templates/docs.js +++ b/docs/src/templates/docs.js @@ -1,9 +1,8 @@ -DocsController.$inject = ['$location', '$window', '$cookies', '$filter']; -function DocsController($location, $window, $cookies, $filter) { -  window.$root = this.$root; +DocsController.$inject = ['$scope', '$location', '$window', '$cookies', '$filter']; +function DocsController(scope, $location, $window, $cookies, $filter) { +  window.$root = scope.$root; -  var scope = this, -      OFFLINE_COOKIE_NAME = 'ng-offline', +  var OFFLINE_COOKIE_NAME = 'ng-offline',        DOCS_PATH = /^\/(api)|(guide)|(cookbook)|(misc)|(tutorial)/,        INDEX_PATH = /^(\/|\/index[^\.]*.html)$/,        filter = $filter('filter'); @@ -160,6 +159,6 @@ angular.module('ngdocs', [], function($locationProvider, $filterProvider) {        return text && text.replace(/^angular\.module\.([^\.]+)(\.(.*))?$/, function(_, module, _0, name){          return 'Module ' + module + (name ? ' - ' + name : '');        }); -    } +    };    });  }); | 
