1

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

1 Answer 1

1

You need to add it under the declarations too

 declarations: [StudyDetailsComponent, BasicInformationComponent, MaintenanceComponent, ProcedureCostComponent, CountryListComponent, StudyListComponent, MatchSiteComponent, DialogCTMSComponent ],
Sign up to request clarification or add additional context in comments.

5 Comments

Hi @Sajeetharan thanks for your prompt answer i have created other components that time this error didn't occur why now can you please let me know
All the components should be declared inside the module.If you have created using cli it will be automatically added to declarations
that's correct i use to create with CLi only need to add entry component because if I am removed entryComponent i got error this was not add in entrycomponent please let me know why
Can you please provide UpVote for my question if it is possible thanks in advane

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.