Error : Cannot determine the module for class

Discussão em 'Angular' iniciado por jitenderd, Outubro 27, 2024.

  1. jitenderd

    jitenderd Guest

    I have a directive DialogHostDirective used in one of my component DialogComponent in Module A. It is used at a ng-template tag working fine in module A. The directive is having a ViewContainerRef used for inserting a template within the component.

    I am trying to use the DialogComponent in my module B, its giving me an error:

    ERROR in Error: Cannot determine the module for class DialogHostDirective in C:/Users/jitdagar/Desktop/TDP/pwt-ui-common/src/app/components/dialog/dialog-host.directive.ts! Add DialogHostDirective to the NgModule to fix it.

    app.module for module A

    @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 {}


    I am not declaring any component in module B as they are already declared in module A.

    Continue reading...

Compartilhe esta Página