title: Select all Checkboxes with single selection of checkbox in angular5 using angular material
body: <p>am written code like this in HTML:</p>
  
  <pre><code>&lt;table class="table tableWidths shadowTable"&gt;
        &lt;thead&gt;
          &lt;tr class="tableHeaderBgColor"&gt;
            &lt;th&gt;
              &lt;mat-checkbox (change)="$event ? masterToggle() : null" [checked]="selection.hasValue() &amp;&amp; isAllSelected()" [indeterminate]="selection.hasValue() &amp;&amp; !isAllSelected()"&gt;
              &lt;/mat-checkbox&gt;
            &lt;/th&gt;
            &lt;th&gt;Status&lt;/th&gt;
            &lt;th&gt;Conflict ID&lt;/th&gt;
            &lt;th&gt;Conflict Party&lt;/th&gt;
            &lt;th&gt;Conflict Party ID&lt;/th&gt;
            &lt;th&gt;Account Name&lt;/th&gt;
            &lt;th&gt;Account Owner Name&lt;/th&gt;
            &lt;th&gt;Account Owner ID&lt;/th&gt;
            &lt;th&gt;Edit&lt;/th&gt;
          &lt;/tr&gt;
        &lt;/thead&gt;
        &lt;tbody&gt;
          &lt;ng-container *ngFor="let conf of conflicts;let ns=index;let odd=odd;"&gt;
            &lt;tr [class.tableOdd]="odd"&gt;
              &lt;td&gt;
                &lt;mat-checkbox (click)="$event.stopPropagation()" (change)="$event ? selection.toggle(conf) : null" [checked]="selection.isSelected(conf)"&gt;
                &lt;/mat-checkbox&gt;
              &lt;/td&gt;
              &lt;td&gt;{{conf.Status}}&lt;/td&gt;
              &lt;td&gt;
                {{conf.Conflict_ID}}
              &lt;/td&gt;
              &lt;td&gt;{{conf.Conflict_Party}}&lt;/td&gt;
              &lt;td&gt;{{conf.Conflict_Party_ID}}&lt;/td&gt;
              &lt;td&gt;{{conf.Account_Name}}&lt;/td&gt;
              &lt;td&gt;{{conf.Account_Owner_Name}}&lt;/td&gt;
              &lt;td&gt;{{conf.Account_Owner_ID}}&lt;/td&gt;
              &lt;td&gt;
                &lt;mat-icon&gt;edit&lt;/mat-icon&gt;
              &lt;/td&gt;
            &lt;/tr&gt;
          &lt;/ng-container&gt;
        &lt;/tbody&gt;
      &lt;/table&gt;
  </code></pre>
  
  <p>in .ts file code wrote like this:</p>
  
  <pre><code>conflicts = [
      {
        Status: 'Pending',
        Conflict_ID: 203888400,
        Conflict_Party: 'Collier County Pulish',
        Conflict_Party_ID: 12345,
        Account_Name: 'Asian Group LD',
        Account_Owner_Name: 'Mike',
        Account_Owner_ID: 12345, checked: false
      },
      {
        Status: 'Approved',
        Conflict_ID: 203888400,
        Conflict_Party: 'Collier County Pulish',
        Conflict_Party_ID: 12345,
        Account_Name: 'Asian Group LD',
        Account_Owner_Name: 'Mary',
        Account_Owner_ID: 12345, checked: false
      }
    ]    
  isAllSelected() {
          const numSelected = this.selection.selected.length;
          const numRows = this.conflicts.length;
          return numSelected === numRows;
        }
  
        masterToggle() {
          this.isAllSelected() ?
            this.selection.clear() :
            this.conflicts.forEach(row =&gt; this.selection.select());
        }
        isSelected(item) {
          console.log('item ' + JSON.stringify(item));
        }
  </code></pre>
  
  <p>In my array Conflict ID is the value to getting further processing. Whenever selection done get the key value from this key 'Conflict_ID'.
  Here am unable to select all checkboxes at single selection in the table. 
  I am able to de-select the all checkboxes.
  Can anybody suggest some solution for this.</p>