I just started to upgrade an Angular project from 9.1.0 to 10.0.12 It is still a hybrid app and has couple of components upgraded (from Angular JS) as described in the Angular docs
However after the Update to Angular 10 those upgraded components would not load and result in the following error
Class constructor UpgradeComponent cannot be invoked without 'new' (at new MyUpgradedComponentDirective)
I searched the Changelog and didn't found any information regarding UpgradeComponent.
After endless search without results I went to trial & error mode.
I discovered that there is a jit
property on the @Directive
, if set to true
the mentioned error goes away.
With adding jit: true
the upgraded component code looks something like this
@Directive({
selector: 'my-angular-selector',
jit: true,
})
export class MyDirective extends UpgradeComponent {
constructor(elementRef: ElementRef, injector: Injector) {
super('angularJsDirectiveSelector', elementRef, injector);
}
}