Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 400f936

Browse files
committed
fix(ngController): change controllerAlias to controllerAs.
1 parent 7812ae7 commit 400f936

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/ng/directive/ngView.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@
105105
$routeProvider.when('/Book/:bookId', {
106106
templateUrl: 'book.html',
107107
controller: BookCntl,
108-
controllerAlias: 'book'
108+
controllerAs: 'book'
109109
});
110110
$routeProvider.when('/Book/:bookId/ch/:chapterId', {
111111
templateUrl: 'chapter.html',
112112
controller: ChapterCntl,
113-
controllerAlias: 'chapter'
113+
controllerAs: 'chapter'
114114
});
115115
116116
// configure html5 to get links working on jsfiddle
@@ -204,8 +204,8 @@ var ngViewDirective = ['$http', '$templateCache', '$route', '$anchorScroll', '$c
204204
if (current.controller) {
205205
locals.$scope = lastScope;
206206
controller = $controller(current.controller, locals);
207-
if (current.controllerAlias) {
208-
lastScope[current.controllerAlias] = controller;
207+
if (current.controllerAs) {
208+
lastScope[current.controllerAs] = controller;
209209
}
210210
element.children().data('$ngControllerController', controller);
211211
}

src/ng/route.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ function $RouteProvider(){
4444
* - `controller` – `{(string|function()=}` – Controller fn that should be associated with newly
4545
* created scope or the name of a {@link angular.Module#controller registered controller}
4646
* if passed as a string.
47-
* - `controllerAlias` – `{string=}` – A controller alias name. If present the controller will be
48-
* published to scope under the `controllerAlias` name.
47+
* - `controllerAs` – `{string=}` – A controller alias name. If present the controller will be
48+
* published to scope under the `controllerAs` name.
4949
* - `template` – `{string=|function()=}` – html template as a string or function that returns
5050
* an html template as a string which should be used by {@link ng.directive:ngView ngView} or
5151
* {@link ng.directive:ngInclude ngInclude} directives.

test/ng/directive/ngViewSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe('ngView', function() {
6363
};
6464

6565
module(function($compileProvider, $routeProvider) {
66-
$routeProvider.when('/some', {templateUrl: '/tpl.html', controller: Ctrl, controllerAlias: 'ctrl'});
66+
$routeProvider.when('/some', {templateUrl: '/tpl.html', controller: Ctrl, controllerAs: 'ctrl'});
6767
});
6868

6969
inject(function($route, $rootScope, $templateCache, $location) {

0 commit comments

Comments
 (0)