title: Angular5 Need function to check/uncheck mat-checkbox inside mat-table
body: <p>I can get checkboxes within the table to emit changes on check/uncheck, but  am having troubles reciprocating when clicking on map pins to toggle checkbox states. </p>
  
  <p><a href="https://i.stack.imgur.com/CBJsu.png" rel="nofollow noreferrer">my table with map</a></p>
  
  <p>Here's my table:</p>
  
  <pre><code>      &lt;mat-table [dataSource]="dataSource"&gt;
          &lt;ng-container matColumnDef="number"&gt;
            &lt;mat-header-cell *matHeaderCellDef&gt; Number &lt;/mat-header-cell&gt;
            &lt;mat-cell *matCellDef="let stock"&gt;
              // #myCheckbox needs to be unique
              &lt;mat-checkbox #myCheckbox [checked] (change)="selectStock(stock, $event)"&gt;&lt;/mat-checkbox&gt; &lt;a href=""&gt;{{ stock.number }}&lt;/a&gt;
            &lt;/mat-cell&gt;
          &lt;/ng-container&gt;
          &lt;mat-header-row *matHeaderRowDef="displayedColumns"&gt;&lt;/mat-header-row&gt;
          &lt;mat-row *matRowDef="let row; columns: displayedColumns;" (click)="clickRow(row._id,$event)"&gt;&lt;/mat-row&gt;
        &lt;/mat-table&gt; 
  </code></pre>
  
  <p>Then from my map, when you click on a pin, run some function</p>
  
  <pre><code>  (click)="someFunction(myCheckbox)"
  </code></pre>
  
  <p>In my class</p>
  
  <pre><code>    @ViewChild('myCheckbox') private myCheckbox: MatCheckbox;
  
      someFunction(myCheckbox){
           if (stock.isChecked) {
              this.myCheckbox.checked = false;
              } else {
              this.myCheckbox.checked = true;
           }
      }        
  </code></pre>
  
  <p>This is the example I'm working off of but it's applying the same #id to each checkbox so only the first checkbox gets toggled (I'm assuming I need unique a unique id for each checkbox?)</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/46832522/angular-mat-checkbox-getelementbyid">Angular mat-checkbox getElementById</a></li>
  </ul>