title: How to inject mat dialog into service?
body: <p>Hi I have a service for the Angular material dialog, like this:</p>
  
  <pre><code>export class DialogModelService {
    participant: ParticipantInfoDTO;
  
    constructor(private dialog: MatDialog, route: ActivatedRoute) {
      this.participant = route.snapshot.data['participant'];
    }
  
    openEcheqSelectorDialog(): Observable&lt;any&gt; {
    const dialogRef =     this.dialog.open(EcheqSelectorComponent, {
        width: '600px',
        maxHeight: 'calc(100vh - 2em)',
        data: {
          participant: console.log('participantIDTest', this.participant)
        }
      });
  
      return dialogRef.afterClosed();
    }
  }
  </code></pre>
  
  <p>And now I try it to inject in a component like this:</p>
  
  <pre><code>
  export class DetailComponent implements OnInit  {
  
  
    @Input() participant: ParticipantInfoDTO;
  
    constructor(private dialog: MatDialog, route: ActivatedRoute, private dialogModelService:  DialogModelService) {
      this.participant = route.snapshot.data['participant'];
    }
  
    ngOnInit() {
  
    }
  
    openEcheqSelectorDialog(){
      this.dialogModelService.openEcheqSelectorDialog().subscribe(data =&gt; console.log(data));
    }
  }
  
  </code></pre>
  
  <p>and this is the template:</p>
  
  <pre><code>
    &lt;button mat-raised-button class="button-spacing" (click)="openEcheqSelectorDialog()" i18n&gt;Send echeq&lt;/button&gt;
  
  </code></pre>
  
  <p>And I have the component declard in this module:</p>
  
  <pre><code> @NgModule({
        declarations: [ListComponent, DetailComponent, ExtendedSearchComponent, LoaderComponent, ChangeEmailComponent],
        exports: [LoaderComponent, DetailComponent],
  
  
  export class ParticipantModule {}
  </code></pre>
  
  <p>But I get this error:</p>
  
  <pre><code>DetailComponent.html:9 ERROR Error: No component factory found for EcheqSelectorComponent. Did you add it to @NgModule.entryComponents?
      at noComponentFactoryError (core.js:7754)
      at CodegenComponentFactoryResolver.push../node_modules/@angular/core/fesm5/core.js.CodegenComponentFactoryResolver.resolveComponentFactory (core.js:7792)
      at CdkPortalOutlet.push../node_modules/@angular/cdk/esm5/portal.es5.js.CdkPortalOutlet.attachComponentPortal (portal.es5.js:654)
      at 
  </code></pre>
  
  <p>So my question is: what I have to change? </p>
  
  <p>Thank you</p>
  
  <p>I have that. I have put them both in the module:</p>
  
  <pre><code>@NgModule({
    declarations: [
      EcheqQuestionComponent,
      EcheqDisplayComponent,
      EcheqViewListComponent,
      EcheqViewItemComponent,
      EcheqSelectorComponent,
      MetaBoxComponent,
      ConfirmDialogComponent,
      StrenumQuestionComponent,
      StrlistQuestionComponent,
      RadioQuestionComponent
    ],
    exports:[
      EcheqSelectorComponent
    ],
  
    imports: [
      // Angular
      CommonModule,
      FormsModule,
  
      // Angular Material
      MatDialogModule,
      MatButtonModule,
      MatIconModule,
      MatInputModule,
      MatSortModule,
      MatPaginatorModule,
      MatTableModule,
      MatExpansionModule,
      MatCardModule,
      MatDividerModule,
      MatCheckboxModule,
      MatRadioModule,
      MatSelectModule,
  
      // Carapax
      AuthModule,
      ParticipantEcheqRoutingModule,
      SharedModule
    ],
    entryComponents: [
      EcheqSelectorComponent,
      ConfirmDialogComponent
    ]
  })
  export class ParticipantEcheqModule { }
  </code></pre>