title: Angular Material dialog in lazy loaded module
body: <p>In my Angular app i have a module called <code>MaterialModule</code> that includes the following content:</p>
  
  <pre><code>imports: [
    MatDialogModule,
    ...
  ],
  exports: [
    MatDialogModule,
    ...
  ]
  </code></pre>
  
  <p>It is exported in a module called <code>SharedModule</code>:</p>
  
  <pre><code>@NgModule({
    imports: [
      MaterialModule,
      ...
    ],
    exports: [
      MaterialModule,
      ...
    ]
  })
  export class SharedModule { }
  </code></pre>
  
  <p>I would like to show a dialog from one of my lazy loaded components, so in my lazy loaded module i import this <code>SharedModule</code> and add the dialog component as an entry component:</p>
  
  <pre><code>@NgModule({
    declarations: [
      MyLazyLoadedComponent,
      MyDialogComponent,
      ...
    ],
    imports: [
      CommonModule,
      SharedModule,
      ...
    ],
    entryComponents: [MyDialogComponent]
  })
  export class MyLazyLoadedModule { }
  </code></pre>
  
  <p>But whenever i try to open the dialog from <code>MyLazyLoadedComponent</code>, i get the following error message:</p>
  
  <blockquote>
    <p>No component factory found for MyDialogComponent. Did you add it to
    @NgModule.entryComponents?</p>
  </blockquote>
  
  <p>Opening dialogs from components that are not lazy loaded works fine.</p>
  
  <p>I'd really appreciate any advice on what could be wrong with my configuration.</p>