title: Angular 6 - MatDialog - EventEmitter - share object to parent component from MatDialog
body: <p>Right now able to communicate between two components. but don't know how to pass user (selected) entered value as Object via event emitter from MatDialog component to the parent component. Here I want to pass selected option value and text area value as object after clicking the submit button.</p>
  
  <p><strong>dialog.html</strong></p>
  
  <pre><code>          &lt;mat-select [(ngModel)]="selectedIssue"  [ngModelOptions]="{standalone: true}"&gt;
              &lt;mat-option  [value]="option1"&gt;Option AA&lt;/mat-option&gt;
              &lt;mat-option  [value]="option2"&gt;Option BB&lt;/mat-option&gt;
              &lt;mat-option  [value]="option3"&gt;Option CC&lt;/mat-option&gt;
              &lt;mat-option  [value]="option4"&gt;Option DD&lt;/mat-option&gt;
              &lt;mat-option  [value]="option5"&gt;Option EE&lt;/mat-option&gt;
            &lt;/mat-select&gt;
  
  
           &lt;div&gt;
              &lt;textarea class="mention-reason" [(ngModel)]="reason" [ngModelOptions]="{standalone: true}"&gt;&lt;/textarea&gt;
          &lt;/div&gt;
  
      &lt;button class="cancel" matDialogClose&gt;Cancel&lt;/button&gt;      
      &lt;button class="submit" [mat-dialog-close] (click)="submitUserReason()"&gt;Submit&lt;/button&gt;&lt;/span&gt;
  </code></pre>
  
  <p><strong>dialog.ts</strong></p>
  
  <pre><code>onSubmitReason = new EventEmitter();
      submitUserReason(): void {
          this.onSubmitReason.emit('hello');
      }
  
      onConfirmClick(): void {
          this.dialogRef.close(true);     
      }
  </code></pre>
  
  <p><strong>parent.ts</strong></p>
  
  <pre><code>callSupport() {
          const dialogRef = this.dialog.open(customerSupportComponent);
          const subscribeDialog = dialogRef.componentInstance.onSubmitReason.subscribe((data) =&gt; {
            console.log('dialog data', data);
            //i can see 'hello' from MatDialog
          });
  
      dialogRef.afterClosed().subscribe(result =&gt; {      
        subscribeDialog.unsubscribe();
      });
  </code></pre>
  
  <p>Thanks so much whoever helping.</p>