将Angular 8迁移到9(不导出符号)

时间:2020-11-03 16:06:11

标签: angular migration ng-modules

我的角度应用程序从8.2迁移到角度9后,我遇到以下错误:

在C:/path/xpto.component.ts中声明的Symbol XptoComponent错误没有从@ angular / core导出(导入到C:/path/parts.module.ts)。

代码是:

@NgModule({
    declarations: [
        forwardRef(() => XptoComponent ),
    ],
    imports: [
        CommonModule,
    ],
    providers: [],
    exports: [forwardRef(() => XptoComponent ), CommonModule,
    ]
})
export class PartsModule {

    public static forRoot(): ModuleWithProviders<PartsModule> {
    return {
        ngModule: PartsModule
    };
}

和组件

@Component({
    selector: 'stuff',
    templateUrl: './stuff.component.html',

})
export class XptoComponent {
}

我发现该错误与forwardRef有关,但是我该如何使用forwardRef处理该错误(我需要它)。

0 个答案:

没有答案