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:
Rado Kirov 2017-09-05 22:44:32 -07:00
parent edf423af3d
commit 1302e54947
2 changed files with 6 additions and 12 deletions

View File

@ -13,8 +13,6 @@ import {$COMPILE, $INJECTOR, $PARSE, INJECTOR_KEY, REQUIRE_INJECTOR, REQUIRE_NG_
import {DowngradeComponentAdapter} from './downgrade_component_adapter';
import {controllerKey, getComponentName} from './util';
let downgradeCount = 0;
/**
* @whatItDoes
*
@ -57,9 +55,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,
@ -90,10 +85,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);
const projectableNodes = facade.compileContents();

View File

@ -26,11 +26,11 @@ export class DowngradeComponentAdapter {
private changeDetector: ChangeDetectorRef|null = null;
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<any>) {
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<any>) {
(this.element[0] as any).id = id;
this.componentScope = scope.$new();
}