title: How to solve error Component is not part of any NgModule or not imported correctly in angular 6?
body: <p>This is error i am getting:-</p>
  
  <pre><code>&lt;b&gt;Error: Component Component is not part of any NgModule or the module has not been imported into your module.
  Error: Component Component is not part of any NgModule or the module has not been imported into your module.&lt;/b&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/JpnH4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JpnH4.png" alt="enter image description here"></a></p>
  
  <p><b>I want my setup module to be lazily loaded but getting error like component is not part of module or the module has not been imported into your module</b></p>
  
  <pre><code>//This is my app.module.ts
  import { BrowserModule, Title } from '@angular/platform-browser';
  import { NgModule } from '@angular/core';
  import { FormsModule } from '@angular/forms';
  import { ReactiveFormsModule } from '@angular/forms';
  import { LeaveService } from './EW_Leave/leave.service';
  import { UtilsModule } from './EW_Utils/utils.module';
  import { JobReferenceComponent } from '../app/EW_Utils/job-reference/job-reference.component'
  import { CommonModule } from '@angular/common';
  import { AppComponent } from './app.component';
  import { AppRoutingModule } from './app-routing.module';
  import { EWDashboardComponent } from './EW_Dashboard/ew-dashboard.component';
  import { EWLoginComponent } from './EW_Login/ew-login.component';
  
  
  @NgModule({
    imports: [
      StorageServiceModule,
      CommonModule,
      BrowserModule,
      FormsModule, ReactiveFormsModule,
      AppRoutingModule,
      UtilsModule, LeaveModule, 
    ],
    declarations: [
      AppComponent, JobReferenceComponent, EWDashboardComponent, EWLoginComponent
    ],
    exports: [],
    providers: [LeaveService, Title],
    bootstrap: [AppComponent]
  })
  export class AppModule {
  
  
  
  
  }
  </code></pre>
  
  <p>//this is my app-routing.module.ts</p>
  
  <pre><code>import { NgModule } from '@angular/core';
  import { RouterModule, Routes } from '@angular/router';
  import { EWDashboardComponent } from './EW_Dashboard/ew-dashboard.component';
  import { EWLoginComponent } from './EW_Login/ew-login.component';
  import { SetupDashboardComponent } from './EW_Setup/setup-dashboard/setup-dashboard.component';
  import {CompaniesSetupComponent} from './EW_Setup/companies-setup/companies-setup.component';
  const appRoutes: Routes = [
    { path: 'login', component: EWLoginComponent },
    { path: 'dashboard', component: EWDashboardComponent },
    { path: '', redirectTo: 'login', pathMatch: 'full' },
    { path: 'setup',
  
     loadChildren: './EW_Setup/setup.module#CustomersModule'
  
    },
  
  
  
  ]
  @NgModule({
    imports: [RouterModule.forRoot(appRoutes)],
    exports: [RouterModule],
    declarations: []
  })
  
  export class AppRoutingModule {
  
  
  }
  </code></pre>
  
  <p><b>THIS BELOW SETUP MODULE THAT I WANT TO BE LAZILY LOADED</b></p>
  
  <pre><code>import { NgModule } from '@angular/core';
  import { RouterModule, Routes } from '@angular/router';
  import { CompaniesSetupComponent } from './companies-setup/companies-setup.component';
  import { SetupDashboardComponent } from './setup-dashboard/setup-dashboard.component';
  import { BusinessUnitSetupComponent } from './business-unit-setup/business-unit-setup.component';
  
  const appRoutes: Routes = [
  
    { path: '', component: SetupDashboardComponent},
  ]
  @NgModule({
    imports: [RouterModule.forChild(appRoutes)],
    exports: [],
    declarations: []
  })
  
  export class SetupRoutingModule {
  
  
  }
  </code></pre>
  
  <p>//THIS IS MY SETUP.MODULE.TS FILE</p>
  
  <pre><code>import { NgModule } from '@angular/core';
  import { CommonModule } from '@angular/common';
  import { UtilsModule } from '../EW_Utils/utils.module';
  import { FormsModule } from '@angular/forms';
  import { ReactiveFormsModule } from '@angular/forms';
  import { SetupDashboardComponent } from './setup-dashboard/setup-dashboard.component';
  @NgModule({
    imports: [
      CommonModule,UtilsModule,FormsModule,ReactiveFormsModule,NgxSpinnerModule,SharedModule,SetupRoutingModule,Ng2SearchPipeModule,GrowlerModule,TextareaAutosizeModule
    ],
    declarations: [ SetupDashboardComponent, SidebarMenuComponent, CompaniesSetupComponent, BusinessUnitSetupComponent],
    providers:[CompaniesSetupService,GrowlerService,CommonApiService],
    entryComponents:[]
  })
  export class SetupModule { }
  </code></pre>