diff options
| author | Misko Hevery | 2013-04-29 14:27:45 -0400 |
|---|---|---|
| committer | Misko Hevery | 2013-04-29 14:28:54 -0400 |
| commit | 400f9360bb2f7553c5bd3b1f256a5f3db175b7bc (patch) | |
| tree | 1ffaaaacded8de30b66de384954f49366ec11b7e | |
| parent | 7812ae75d578314c1a285e9644fc75812940eb1d (diff) | |
| download | angular.js-400f9360bb2f7553c5bd3b1f256a5f3db175b7bc.tar.bz2 | |
fix(ngController): change controllerAlias to controllerAs.
| -rw-r--r-- | src/ng/directive/ngView.js | 8 | ||||
| -rw-r--r-- | src/ng/route.js | 4 | ||||
| -rw-r--r-- | test/ng/directive/ngViewSpec.js | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/ng/directive/ngView.js b/src/ng/directive/ngView.js index 8d7c87c5..d5ef2c71 100644 --- a/src/ng/directive/ngView.js +++ b/src/ng/directive/ngView.js @@ -105,12 +105,12 @@ $routeProvider.when('/Book/:bookId', { templateUrl: 'book.html', controller: BookCntl, - controllerAlias: 'book' + controllerAs: 'book' }); $routeProvider.when('/Book/:bookId/ch/:chapterId', { templateUrl: 'chapter.html', controller: ChapterCntl, - controllerAlias: 'chapter' + controllerAs: 'chapter' }); // configure html5 to get links working on jsfiddle @@ -204,8 +204,8 @@ var ngViewDirective = ['$http', '$templateCache', '$route', '$anchorScroll', '$c if (current.controller) { locals.$scope = lastScope; controller = $controller(current.controller, locals); - if (current.controllerAlias) { - lastScope[current.controllerAlias] = controller; + if (current.controllerAs) { + lastScope[current.controllerAs] = controller; } element.children().data('$ngControllerController', controller); } diff --git a/src/ng/route.js b/src/ng/route.js index 4014dfa8..12e560c7 100644 --- a/src/ng/route.js +++ b/src/ng/route.js @@ -44,8 +44,8 @@ function $RouteProvider(){ * - `controller` – `{(string|function()=}` – Controller fn that should be associated with newly * created scope or the name of a {@link angular.Module#controller registered controller} * if passed as a string. - * - `controllerAlias` – `{string=}` – A controller alias name. If present the controller will be - * published to scope under the `controllerAlias` name. + * - `controllerAs` – `{string=}` – A controller alias name. If present the controller will be + * published to scope under the `controllerAs` name. * - `template` – `{string=|function()=}` – html template as a string or function that returns * an html template as a string which should be used by {@link ng.directive:ngView ngView} or * {@link ng.directive:ngInclude ngInclude} directives. diff --git a/test/ng/directive/ngViewSpec.js b/test/ng/directive/ngViewSpec.js index 3150c040..93b85002 100644 --- a/test/ng/directive/ngViewSpec.js +++ b/test/ng/directive/ngViewSpec.js @@ -63,7 +63,7 @@ describe('ngView', function() { }; module(function($compileProvider, $routeProvider) { - $routeProvider.when('/some', {templateUrl: '/tpl.html', controller: Ctrl, controllerAlias: 'ctrl'}); + $routeProvider.when('/some', {templateUrl: '/tpl.html', controller: Ctrl, controllerAs: 'ctrl'}); }); inject(function($route, $rootScope, $templateCache, $location) { |
