title: angular mat-checkbox checked value
body: <p>I have ts code:</p>
  <pre><code>import {Component} from '@angular/core';
  
  @Component({
    selector: 'checkbox-configurable-example',
    templateUrl: 'checkbox-configurable-example.html',
    styleUrls: ['checkbox-configurable-example.css'],
  })
  export class CheckboxConfigurableExample {
    checked = false;
    indeterminate = false;
    align = 'start';
    disabled = false;
  
    items = [{selected: true, label: 'First Item'}, {selected: false, label: 'Second Item'}];
  }
  </code></pre>
  <p>html code:</p>
  <pre><code>&lt;mat-card&gt;
    &lt;mat-card-content&gt;
      &lt;h2 class=&quot;example-h2&quot;&gt;Checkbox configuration&lt;/h2&gt;
  
      &lt;section class=&quot;example-section&quot;&gt;
        &lt;mat-checkbox class=&quot;example-margin&quot; [(ngModel)]=&quot;checked&quot;&gt;Items&lt;/mat-checkbox&gt;
      &lt;/section&gt;
  
      &lt;h2 class=&quot;example-h2&quot;&gt;Result&lt;/h2&gt;
  
      &lt;section class=&quot;example-section&quot; *ngFor=&quot;let item of items&quot;&gt;
        &lt;mat-checkbox  class=&quot;example-margin&quot; [(ngModel)]=&quot;checked&quot;&gt;{{item.label}}&lt;/mat-checkbox&gt;
      &lt;/section&gt;
  
  
    &lt;/mat-card-content&gt;
  &lt;/mat-card&gt;
  </code></pre>
  <p>css file:</p>
  <pre><code>.example-h2 {
    margin: 10px;
  }
  
  .example-section {
    display: flex;
    align-content: center;
    align-items: center;
    height: 60px;
  }
  
  .example-margin {
    margin: 0 10px;
  }
  </code></pre>
  <p>According to the code, I have a mat-checkbox 'Items' and 2 mat-checkboxes 'First Item', 'Second Item'. If the 'Items' is unchecked, 'First Item' and 'Second Item' must be automatically unchecked. If you check the 'Items' checkbox, checkboxes for 'First Item' and 'Second Item' must be checked.</p>
  <p>How to implement the following behavior (in addition to the above conditions)?</p>
  <ol>
  <li>If 'First Item' or 'Second Item' is selected, the 'Items' must also go to the checked state. Moreover, if 'First Item' is selected, 'checked' status of 'Second Item' does not change and vice versa.</li>
  <li>If 'First Item' and 'Second Item' checkboxes are unchecked, the 'Items' checkbox must also be unchecked.</li>
  </ol>
  <p><a href="https://i.stack.imgur.com/y8brP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y8brP.png" alt="enter image description here" /></a></p>