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
This commit is contained in:
parent
865b48d78b
commit
b6833d1bbd
|
@ -18,8 +18,6 @@ interface Thenable<T> {
|
||||||
then(callback: (value: T) => any): any;
|
then(callback: (value: T) => any): any;
|
||||||
}
|
}
|
||||||
|
|
||||||
let downgradeCount = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @whatItDoes
|
* @whatItDoes
|
||||||
*
|
*
|
||||||
|
@ -64,9 +62,6 @@ export function downgradeComponent(info: {
|
||||||
/** @deprecated since v4. This parameter is no longer used */
|
/** @deprecated since v4. This parameter is no longer used */
|
||||||
selectors?: string[];
|
selectors?: string[];
|
||||||
}): any /* angular.IInjectable */ {
|
}): any /* angular.IInjectable */ {
|
||||||
const idPrefix = `NG2_UPGRADE_${downgradeCount++}_`;
|
|
||||||
let idCount = 0;
|
|
||||||
|
|
||||||
const directiveFactory:
|
const directiveFactory:
|
||||||
angular.IAnnotatedFunction = function(
|
angular.IAnnotatedFunction = function(
|
||||||
$compile: angular.ICompileService,
|
$compile: angular.ICompileService,
|
||||||
|
@ -111,10 +106,9 @@ export function downgradeComponent(info: {
|
||||||
throw new Error('Expecting ComponentFactory for: ' + getComponentName(info.component));
|
throw new Error('Expecting ComponentFactory for: ' + getComponentName(info.component));
|
||||||
}
|
}
|
||||||
|
|
||||||
const id = idPrefix + (idCount++);
|
|
||||||
const injectorPromise = new ParentInjectorPromise(element);
|
const injectorPromise = new ParentInjectorPromise(element);
|
||||||
const facade = new DowngradeComponentAdapter(
|
const facade = new DowngradeComponentAdapter(
|
||||||
id, element, attrs, scope, ngModel, injector, $injector, $compile, $parse,
|
element, attrs, scope, ngModel, injector, $injector, $compile, $parse,
|
||||||
componentFactory, wrapCallback);
|
componentFactory, wrapCallback);
|
||||||
|
|
||||||
const projectableNodes = facade.compileContents();
|
const projectableNodes = facade.compileContents();
|
||||||
|
|
|
@ -28,13 +28,12 @@ export class DowngradeComponentAdapter {
|
||||||
private appRef: ApplicationRef;
|
private appRef: ApplicationRef;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private id: string, private element: angular.IAugmentedJQuery,
|
private element: angular.IAugmentedJQuery, private attrs: angular.IAttributes,
|
||||||
private attrs: angular.IAttributes, private scope: angular.IScope,
|
private scope: angular.IScope, private ngModel: angular.INgModelController,
|
||||||
private ngModel: angular.INgModelController, private parentInjector: Injector,
|
private parentInjector: Injector, private $injector: angular.IInjectorService,
|
||||||
private $injector: angular.IInjectorService, private $compile: angular.ICompileService,
|
private $compile: angular.ICompileService, private $parse: angular.IParseService,
|
||||||
private $parse: angular.IParseService, private componentFactory: ComponentFactory<any>,
|
private componentFactory: ComponentFactory<any>,
|
||||||
private wrapCallback: <T>(cb: () => T) => () => T) {
|
private wrapCallback: <T>(cb: () => T) => () => T) {
|
||||||
(this.element[0] as any).id = id;
|
|
||||||
this.componentScope = scope.$new();
|
this.componentScope = scope.$new();
|
||||||
this.appRef = parentInjector.get(ApplicationRef);
|
this.appRef = parentInjector.get(ApplicationRef);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue