Angular Dialog: No component factory found for DialogModule. : <p>Trying to make a dialog using feature model in angular 6. But I'm getting this error:</p>

<blockquote>
  <p>No component factory found for DialogModule. Did you add it to @NgModule.entryComponents?</p>
</blockquote>

<p>Everyone keeps saying to use </p>

<blockquote>
  <p>entryComponents: [DialogComponent]</p>
</blockquote>

<p>which I am already doing. Also tried to use that in the feature module without success. Here are I think the necessary and simplified files:</p>

<p>app.module.ts</p>

<pre><code>import { DialogModule } from './components/dialog/dialog.module';
import { DialogComponent } from './components/dialog/dialog.component';
...

// AoT requires an exported function for factories
export function HttpLoaderFactory(http: HttpClient) {
  return new TranslateHttpLoader(http);
}

@NgModule({
  declarations: [..., AppComponent],
  imports: [DialogModule],
  entryComponents: [DialogComponent],

  providers: [..., MatDialogModule],
  bootstrap: [AppComponent]
})
export class AppModule {}
</code></pre>

<p>dialog.module.ts</p>

<pre><code>import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { DialogComponent } from './dialog.component';
...

@NgModule({
  imports: [
    CommonModule
  ],
  declarations: [..., DialogComponent],
  exports: [DialogComponent]
})
export class DialogModule {
  ...
}
</code></pre>

<p>some-other.component.ts</p>

<pre><code>import { DialogModule } from '../../components/dialog/dialog.module';
...

@Component({
    ...
})

export class LanguageButtonComponent implements OnInit {

  constructor(private languageService : LanguageService,
    private dialog: MatDialog,) {
  }

  // activated from button
  openDialog() {
    this.dialog.open(DialogModule);
  }
}
</code></pre>

<p>How to get rid of the error?</p>
