title: Angular 9 Material Dialog returning undefined on close
body: <p>I'm using Angular 9 and have a Material dialog that is set to return <code>"test"</code> on close like this:</p>
  
  <pre><code>&lt;mat-dialog-actions align='center'&gt;
      &lt;button mat-raised-button color='primary' [mat-dialog-close]='"test"'&gt;
          Submit
      &lt;/button&gt;
  &lt;/mat-dialog-actions&gt;
  </code></pre>
  
  <p>In my main page component, I'm subscribing to afterAllClosed:</p>
  
  <pre><code>  constructor(private matDialog: MatDialog) { }
  
    OpenMatDialog(data): void {
      this.matDialog.open(
        DialogComponent,
        { data },
      );
  
      if( !this.matDialogCloseSub$ )
        this.matDialogCloseSub$ = this.matDialog.afterAllClosed.subscribe(result =&gt; {
          console.log(result);
        });
    }
  </code></pre>
  
  <p>However, <code>result</code> always comes back as <code>undefined</code>. What am I doing wrong?</p>
  
  <p>I have set the dialog component in <code>app.module.ts</code> in <code>entrycomponents</code> as follows:</p>
  
  <pre><code>@NgModule({
    declarations: [
      AppComponent,
      DialogComponent
    ],
    imports: [
      MatDialogModule,
    ],
    entryComponents: [
      DialogComponent,
    ],
    providers: [],
    bootstrap: [AppComponent]
  })
  export class AppModule { }
  </code></pre>