fix(upgrade): fix upgrade component Closure optimization. (#14801)

$scope and $element are passed to AngularJS, which is not optimized
together with the app. That means properties must be quoted to prevent
renaming.
This commit is contained in:
Martin Probst 2017-03-01 15:49:25 +01:00 committed by Igor Minar
parent 5ba55b0e04
commit 968995a4c6
1 changed files with 2 additions and 1 deletions

View File

@ -355,7 +355,8 @@ export class UpgradeComponent implements OnInit, OnChanges, DoCheck, OnDestroy {
controllerType: angular.IController, $scope: angular.IScope, controllerType: angular.IController, $scope: angular.IScope,
$element: angular.IAugmentedJQuery, controllerAs: string) { $element: angular.IAugmentedJQuery, controllerAs: string) {
// TODO: Document that we do not pre-assign bindings on the controller instance // TODO: Document that we do not pre-assign bindings on the controller instance
const locals = {$scope, $element}; // Quoted properties below so that this code can be optimized with Closure Compiler.
const locals = {'$scope': $scope, '$element': $element};
const controller = this.$controller(controllerType, locals, null, controllerAs); const controller = this.$controller(controllerType, locals, null, controllerAs);
$element.data(controllerKey(this.directive.name), controller); $element.data(controllerKey(this.directive.name), controller);
return controller; return controller;