title: Angular 2 Material: Dynamic Custom Dialogs
body: <p>I'm using Angular 2 Material's dialog component when displaying modals. I've created a base modal (MatModalComponent) that have ng-content and the customize child modals (ReserveSeatModalComponent) that will be included on the base's ng-content.</p>
  
  <p>I'm trying to refactor my dialog calls into one service. So from having to write this everytime I want a dialog displayed:</p>
  
  <pre><code>        let dialogRef = this.dialog.open(ReserveSeatModalComponent, {  
              width: '250px',
              data: {
                  seat: this.selectedSeat
              }
          });
  </code></pre>
  
  <p>I now want it to be called on an open() method inside a service. I'm not sure how will I implement this. I've began with <a href="https://medium.com/@tarik.nzl/making-use-of-dialogs-in-material-2-mddialog-7533d27df41" rel="nofollow noreferrer">Tarik's implementation</a> but I'm blocked on how will I pass the child modal component to the service so it will be the one used by the dialogRef.</p>