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

Commit 18afebe

Browse files
crisbetohansl
authored andcommitted
fix(compiler): remove manual controllerAs logic (#9462)
Currently the `controllerAs` logic in the compiler is done manually, however the same result can be achieved by passing the `controllerAs` value to the `$controller` factory.
1 parent ae8997a commit 18afebe

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/core/services/compiler/compiler.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function mdCompilerService($q, $templateRequest, $injector, $compile, $controlle
114114

115115
//Instantiate controller if it exists, because we have scope
116116
if (controller) {
117-
var invokeCtrl = $controller(controller, locals, true);
117+
var invokeCtrl = $controller(controller, locals, true, controllerAs);
118118
if (bindToController) {
119119
angular.extend(invokeCtrl.instance, locals);
120120
}
@@ -123,10 +123,6 @@ function mdCompilerService($q, $templateRequest, $injector, $compile, $controlle
123123
element.data('$ngControllerController', ctrl);
124124
element.children().data('$ngControllerController', ctrl);
125125

126-
if (controllerAs) {
127-
scope[controllerAs] = ctrl;
128-
}
129-
130126
// Publish reference to this controller
131127
compiledData.controller = ctrl;
132128
}

0 commit comments

Comments
 (0)