小编jit*_*erd的帖子

错误:无法确定类的模块

我在模块 A 中的组件 DialogComponent 之一中使用了指令 DialogHostDirective。它在模块 A 中正常工作的 ng-template 标记中使用。该指令有一个 ViewContainerRef,用于在组件中插入模板。

我试图在我的模块 B 中使用 DialogComponent,它给了我一个错误:

错误中的错误:无法确定 C:/Users/jitdagar/Desktop/TDP/pwt-ui-common/src/app/components/dialog/dialog-host.directive.ts 中 DialogHostDirective 类的模块!将 DialogHostDirective 添加到 NgModule 来修复它。

模块 A 的 app.module

@NgModule({
    declarations: [
        AppComponent,
        ExampleComponent,
        DialogComponent,
        DialogHostDirective,
        OpenDialogContentComponent
    ],
    imports: [
        CommonModule,
        FormsModule,
        HttpModule,
        ReactiveFormsModule,
        BrowserModule,
        AlloyModule,
        MatDialogModule,
        BrowserAnimationsModule
    ],
    entryComponents: [
        DialogComponent,
        OpenDialogContentComponent
    ],
    providers: [
        DialogService
    ],
    exports: [ExampleComponent, DialogComponent, DialogHostDirective],
    bootstrap: [AppComponent]
})
export class PwtUiCommonModule {}
Run Code Online (Sandbox Code Playgroud)

我没有在模块 B 中声明任何组件,因为它们已经在模块 A 中声明了。

angular

5
推荐指数
1
解决办法
9987
查看次数

标签 统计

angular ×1