【问题标题】:Problem with imports/exports/declarations component in Angular [closed]Angular中的导入/导出/声明组件问题[关闭]
【发布时间】:2021-11-18 01:09:40
【问题描述】:

我创建了一个组件,正如您在代码示例中看到的那样,我导入它、导出它甚至声明它,但这并不需要我。你能告诉我可能是什么问题吗?

错误: 出现在 SalesModule 的 NgModule.imports 中,但无法解析为 NgModule 类。 是否缺少@NgModule 注释? 9 导出类 PaymentStatusComponent 实现 OnInit {

sales.module.ts:

@NgModule({
    exports: [PaymentStatusComponent],
    imports: [PaymentStatusComponent],
    declarations: [PaymentStatusComponent]
})
export class SalesModule {}

【问题讨论】:

标签: angular import components


【解决方案1】:

谢天谢地,这是一个简单的修复。

imports 数组中删除 PaymentStatusComponent

为什么? 因为它是一个组件,而imports 数组只需要模块。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-27
    • 2022-01-23
    • 1970-01-01
    相关资源
    最近更新 更多