From 968995a4c6efbf634b1d914e81531bd27c2f3de7 Mon Sep 17 00:00:00 2001 From: Martin Probst Date: Wed, 1 Mar 2017 15:49:25 +0100 Subject: [PATCH] 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. --- modules/@angular/upgrade/src/static/upgrade_component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/@angular/upgrade/src/static/upgrade_component.ts b/modules/@angular/upgrade/src/static/upgrade_component.ts index aa52306ecb..29311e5b41 100644 --- a/modules/@angular/upgrade/src/static/upgrade_component.ts +++ b/modules/@angular/upgrade/src/static/upgrade_component.ts @@ -355,7 +355,8 @@ export class UpgradeComponent implements OnInit, OnChanges, DoCheck, OnDestroy { controllerType: angular.IController, $scope: angular.IScope, $element: angular.IAugmentedJQuery, controllerAs: string) { // 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); $element.data(controllerKey(this.directive.name), controller); return controller;