From b6833d1bbd9190dde604448dc6168ca08b16fa58 Mon Sep 17 00:00:00 2001 From: Rado Kirov Date: Tue, 5 Sep 2017 22:44:32 -0700 Subject: [PATCH] fix(upgrade): remove code setting id attribute. The id was leftover from previous iterations of ngUpgrade and is no longer needed. Moreover, setting it can clash with CSS usage of id. Fixes #18446 --- packages/upgrade/src/common/downgrade_component.ts | 8 +------- .../upgrade/src/common/downgrade_component_adapter.ts | 11 +++++------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/packages/upgrade/src/common/downgrade_component.ts b/packages/upgrade/src/common/downgrade_component.ts index 65357f1fe6..14ebc80738 100644 --- a/packages/upgrade/src/common/downgrade_component.ts +++ b/packages/upgrade/src/common/downgrade_component.ts @@ -18,8 +18,6 @@ interface Thenable { then(callback: (value: T) => any): any; } -let downgradeCount = 0; - /** * @whatItDoes * @@ -64,9 +62,6 @@ export function downgradeComponent(info: { /** @deprecated since v4. This parameter is no longer used */ selectors?: string[]; }): any /* angular.IInjectable */ { - const idPrefix = `NG2_UPGRADE_${downgradeCount++}_`; - let idCount = 0; - const directiveFactory: angular.IAnnotatedFunction = function( $compile: angular.ICompileService, @@ -111,10 +106,9 @@ export function downgradeComponent(info: { throw new Error('Expecting ComponentFactory for: ' + getComponentName(info.component)); } - const id = idPrefix + (idCount++); const injectorPromise = new ParentInjectorPromise(element); const facade = new DowngradeComponentAdapter( - id, element, attrs, scope, ngModel, injector, $injector, $compile, $parse, + element, attrs, scope, ngModel, injector, $injector, $compile, $parse, componentFactory, wrapCallback); const projectableNodes = facade.compileContents(); diff --git a/packages/upgrade/src/common/downgrade_component_adapter.ts b/packages/upgrade/src/common/downgrade_component_adapter.ts index e00605c3ab..93f7cae8c8 100644 --- a/packages/upgrade/src/common/downgrade_component_adapter.ts +++ b/packages/upgrade/src/common/downgrade_component_adapter.ts @@ -28,13 +28,12 @@ export class DowngradeComponentAdapter { private appRef: ApplicationRef; constructor( - private id: string, private element: angular.IAugmentedJQuery, - private attrs: angular.IAttributes, private scope: angular.IScope, - private ngModel: angular.INgModelController, private parentInjector: Injector, - private $injector: angular.IInjectorService, private $compile: angular.ICompileService, - private $parse: angular.IParseService, private componentFactory: ComponentFactory, + private element: angular.IAugmentedJQuery, private attrs: angular.IAttributes, + private scope: angular.IScope, private ngModel: angular.INgModelController, + private parentInjector: Injector, private $injector: angular.IInjectorService, + private $compile: angular.ICompileService, private $parse: angular.IParseService, + private componentFactory: ComponentFactory, private wrapCallback: (cb: () => T) => () => T) { - (this.element[0] as any).id = id; this.componentScope = scope.$new(); this.appRef = parentInjector.get(ApplicationRef); }