Skip to content

Commit b6833d1

Browse files
rkirovmatsko
authored andcommitted
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
1 parent 865b48d commit b6833d1

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

packages/upgrade/src/common/downgrade_component.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ interface Thenable<T> {
1818
then(callback: (value: T) => any): any;
1919
}
2020

21-
let downgradeCount = 0;
22-
2321
/**
2422
* @whatItDoes
2523
*
@@ -64,9 +62,6 @@ export function downgradeComponent(info: {
6462
/** @deprecated since v4. This parameter is no longer used */
6563
selectors?: string[];
6664
}): any /* angular.IInjectable */ {
67-
const idPrefix = `NG2_UPGRADE_${downgradeCount++}_`;
68-
let idCount = 0;
69-
7065
const directiveFactory:
7166
angular.IAnnotatedFunction = function(
7267
$compile: angular.ICompileService,
@@ -111,10 +106,9 @@ export function downgradeComponent(info: {
111106
throw new Error('Expecting ComponentFactory for: ' + getComponentName(info.component));
112107
}
113108

114-
const id = idPrefix + (idCount++);
115109
const injectorPromise = new ParentInjectorPromise(element);
116110
const facade = new DowngradeComponentAdapter(
117-
id, element, attrs, scope, ngModel, injector, $injector, $compile, $parse,
111+
element, attrs, scope, ngModel, injector, $injector, $compile, $parse,
118112
componentFactory, wrapCallback);
119113

120114
const projectableNodes = facade.compileContents();

packages/upgrade/src/common/downgrade_component_adapter.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,12 @@ export class DowngradeComponentAdapter {
2828
private appRef: ApplicationRef;
2929

3030
constructor(
31-
private id: string, private element: angular.IAugmentedJQuery,
32-
private attrs: angular.IAttributes, private scope: angular.IScope,
33-
private ngModel: angular.INgModelController, private parentInjector: Injector,
34-
private $injector: angular.IInjectorService, private $compile: angular.ICompileService,
35-
private $parse: angular.IParseService, private componentFactory: ComponentFactory<any>,
31+
private element: angular.IAugmentedJQuery, private attrs: angular.IAttributes,
32+
private scope: angular.IScope, private ngModel: angular.INgModelController,
33+
private parentInjector: Injector, private $injector: angular.IInjectorService,
34+
private $compile: angular.ICompileService, private $parse: angular.IParseService,
35+
private componentFactory: ComponentFactory<any>,
3636
private wrapCallback: <T>(cb: () => T) => () => T) {
37-
(this.element[0] as any).id = id;
3837
this.componentScope = scope.$new();
3938
this.appRef = parentInjector.get(ApplicationRef);
4039
}

0 commit comments

Comments
 (0)