Mr.M
Mr.M

Reputation: 1490

Getting Error after declaring component in respective Module angular 8

After declaring the component name in module I am getting below error

Here is my study-details module where I have all related components i have mapped here

    import { NgModule } from '@angular/core';
    import { CommonModule } from '@angular/common';
    import { StudyDetailsComponent } from './study-details.component';
    import { RouterModule } from '@angular/router';

    import { PartialsModule } from '../../partials/partials.module';
    import { CoreModule } from '../../../core/core.module';

    /* material components */
    import { MaterialModule } from '../../../shared/modules/material.module';
    /* import componenets for study details */
    import { BasicInformationComponent } from './basic-information/basic-information.component';
    import { MaintenanceComponent } from './maintenance/maintenance.component';
    import { ProcedureCostComponent } from './maintenance/procedure-cost/procedure-cost.component';
    import { CountryListComponent } from './maintenance/procedure-cost/country-list/country-list.component';
    import { StudyListComponent } from './maintenance/procedure-cost/country-list/study-list/study-list.component';
    import { MatchSiteComponent } from './match-site/match-site.component';
    import { FormsModule } from '@angular/forms';
    import { NgxFlagPickerModule } from 'ngx-flag-picker';
    import { DialogCTMSComponent } from './match-site/dialog-ctms/dialog-ctms.component';
    import { MatDialogModule } from '@angular/material';
    //import { DialogCTMSComponent } from '../study-details/match-site/dialog-ctms/dialog-ctms.component';



    @NgModule({
      declarations: [StudyDetailsComponent, BasicInformationComponent, MaintenanceComponent, ProcedureCostComponent, CountryListComponent, StudyListComponent, MatchSiteComponent ],
      imports: [PartialsModule, MaterialModule,MatDialogModule,
        CoreModule,FormsModule,NgxFlagPickerModule,

        CommonModule, RouterModule.forChild([
          {
            path: '',
            component: StudyDetailsComponent
          },
        ])
      ],

      entryComponents: [
        DialogCTMSComponent
      ],

Here is my error i am getting

Error: Uncaught (in promise): Error: Component DialogCTMSComponent is not part of any NgModule or the 
module has not been imported into your module. Error: Component DialogCTMSComponent is not part of 
any NgModule or the module has not been imported into your module.

Please let me know what I am doing wrong here

Upvotes: 1

Views: 268

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222722

You need to add it under the declarations too

 declarations: [StudyDetailsComponent, BasicInformationComponent, MaintenanceComponent, ProcedureCostComponent, CountryListComponent, StudyListComponent, MatchSiteComponent, DialogCTMSComponent ],

Upvotes: 1

Related Questions