title: How to get the selected row values in table in angular?
body: <p><strong>HTML Code</strong>
  I am using a reactive form, well when the user selects any checkbox, and then clicks on Assemble button, i want to get the selected values. Can anyone help me?</p>
  
  <pre><code>&lt;table mat-table [dataSource]="dataSource" fxFill appearance="outline"&gt;
   &lt;!-- Checkbox Column --&gt;
   &lt;ng-container matColumnDef="select"&gt;
      &lt;th mat-header-cell *matHeaderCellDef&gt;
         &lt;mat-checkbox [(ngModel)]="value" 
           (change)="$event ? masterToggle() : null" 
           [checked]="selection.hasValue() &amp;&amp; isAllSelected() == true"
           [indeterminate]="selection.hasValue() &amp;&amp; !isAllSelected()"&gt;
         &lt;/mat-checkbox&gt;
       &lt;/th&gt;
       &lt;td mat-cell *matCellDef="let row"&gt;
          &lt;mat-checkbox (click)="$event.stopPropagation()" 
            (change)="$event ? selection.toggle(row) : null" 
            [checked]="selection.isSelected(row) == true"&gt;
          &lt;/mat-checkbox&gt;
       &lt;/td&gt;
       &lt;/ng-container&gt;
  
       &lt;!-- Name Column --&gt;
       &lt;ng-container matColumnDef="Name"&gt;
          &lt;th mat-header-cell *matHeaderCellDef&gt; Name &lt;/th&gt;
          &lt;td mat-cell *matCellDef="let dataSource"&gt; {{dataSource.name}} &lt;/td&gt;
       &lt;/ng-container&gt;
  
       &lt;!-- Symbol Column --&gt;
       &lt;ng-container matColumnDef="Modified"&gt;
           &lt;th mat-header-cell *matHeaderCellDef&gt; Modified &lt;/th&gt;
           &lt;td mat-cell *matCellDef="let dataArray"&gt; {{dataArray.modifiedAt}} &lt;/td&gt;
       &lt;/ng-container&gt;   
        &lt;tr mat-header-row *matHeaderRowDef="displayedColumns"&gt;&lt;/tr&gt;
        &lt;tr mat-row *matRowDef="let row; columns: displayedColumns;" 
          (click)="selection.toggle(row)"&gt;
        &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/mat-sidenav-container&gt;
     &lt;mat-dialog-actions align="end"&gt;
       &lt;button mat-button (click)="onCancel()"&gt;Cancel&lt;/button&gt;
       &lt;button mat-button type="submit" (click)="onAssemble()" 
          [disabled]="!assemblyForm.valid"&gt; Assemble
      &lt;/button&gt;
  &lt;/mat-dialog-actions&gt;
  </code></pre>