title: Using Angular component in lazy loaded modules
body: <p>I want to use an Angular component in several parts of my application, including in a component inside a lazy loaded module. I don't know how to declare the component for using it in the lazy module. I'll show you some of the relevant parts of the different files:</p>
  
  <p><strong>app.module.ts</strong></p>
  
  <pre><code>import { FpgTimeComponent } from './fpgTime/fpg-time.component';
  
  
  @NgModule({
    declarations: [
        AppComponent, 
        (...)
        FpgTimeComponent
  </code></pre>
  
  <p><strong>app.routing.ts</strong></p>
  
  <pre><code>const appRoutes: Routes = [
  
      { path: '', redirectTo: 'customer', pathMatch: 'full' },
      {
          path: 'customer',
          component: CustomerComponent
      },
      {
          path: 'lazy',
          loadChildren: 'app/lazy/lazy.module#LazyModule'
      }
  ];
  </code></pre>
  
  <p><strong>lazy.module.ts</strong></p>
  
  <pre><code>import { FpgTimeComponent } from '../fpgTime/fpg-time.component';
  
  import { LazyComponent }   from './lazy.component';
  import { routing } from './lazy.routing';
  
  @NgModule({
      imports: [routing],
      declarations: [
          LazyComponent, 
          FpgTimeComponent
      ]
  })
  </code></pre>
  
  <p>The app loads, but when I go to the lazy route, it throws the following error:</p>
  
  <blockquote>
    <p>Uncaught (in promise): Error: Type FpgTimeComponent is part of the
    declarations of 2 modules: AppModule and LazyModule! Please consider
    moving FpgTimeComponent to a higher module that imports AppModule and
    LazyModule. You can also create a new NgModule that exports and
    includes FpgTimeComponent then import that NgModule in AppModule and
    LazyModule.</p>
  </blockquote>
  
  <p>I'm not importing LazyModule anywhere, as it's being lazy loaded. So, how could I declare the component FpgTimeComponent to be able to use it inside the lazy module (and also in non-lazy components)?</p>
  
  <p>Thanks in advance,</p>