title: Angular material dialog - pass types into dialog component
body: <p>I'm working on data driven app and currently I'm facing a problem of passing types into material angular dialog. I want to create reusable dialog form and need to change types for new dialog instance.</p>
  
  <p>Is there a way to pass type into material dialog or into component? Or maybe there is possibility to create types in dialog itself from string passed as data?</p>
  
  <p>I want to use types in dialog component like this (or similar):</p>
  
  <pre><code>export class DialogDynamicItemManagerDialog&lt;T&gt; {
  
      public dialogName: string;
      public items: Array&lt;T&gt;;
      public selectedItem: T;
      ...
  }
  </code></pre>
  
  <p>I've tried to pass the type like this:</p>
  
  <pre><code> OpenDynamicDialog(): void {
      this.dialog.open(DialogDynamicItemManagerDialog&lt;MyType&gt;, {
        data: {
          title: 'Manage items',
          items: this.items
        },
      });
  }
  </code></pre>
  
  <p>but obviously it doesn't work.</p>
  
  <p>I've also tried this:</p>
  
  <pre><code> OpenDynamicDialog(): void {
      const dialogRef = this.dialog.open(DialogDynamicItemManagerDialog, {
        data: {
          title: 'Manage items',
          items: this.items,
          itemType: itemType
        },
      });
  }
  </code></pre>
  
  <p>but I haven't find a way to change string into type in dialog afterwards.</p>