【发布时间】:2016-12-02 21:56:17
【问题描述】:
我正在尝试导入 从 '@angular/upgrade/static' 导入 { UpgradeComponent }; 使用 ngupgrade 在 angular2 中使用 angular1 指令,但我收到此错误。
代码:
import { Directive, ElementRef, Injector } from '@angular/core';
import { UpgradeComponent } from '@angular/upgrade/static';
@Directive({
selector: 'help'
})
export class HelpComponentA1Directive extends UpgradeComponent {
constructor(elementRef: ElementRef, injector: Injector) {
super('help', elementRef, injector);
}
}
【问题讨论】:
-
错误在哪里?请显示错误的堆栈跟踪
-
Rehban,错误消息:main.bundle.js:84 Uncaught SyntaxError: Uncaught SyntaxError: Unexpected token export error shown in the console in section-> export { downgradeComponent } from './src/aot/downgrade_component' ;
-
@johnsam Stacktrace 意味着您不应该发布一行,而是应该从根目录发布一堆调用。
-
@romanc:感谢您抽出宝贵时间查看此内容,从 './src/aot/downgrade_component' 导出 { downgradeComponent }; -> 错误显示在控制台的第一行本身 export { downgradeInjectable } from './src/aot/downgrade_injectable';从 './src/aot/upgrade_component' 导出 { UpgradeComponent };从 './src/aot/upgrade_module' 导出 { UpgradeModule };
标签: angular ng-upgrade angular-upgrade