title: Angular how to do multiple open and close
body: <p>I want do if click to find all same id. </p>
  
  <p>and all same id's isOpen together becomes true.</p>
  
  <p>How to do that?</p>
  
  <p>html</p>
  
  <pre><code>&lt;div  *ngFor="let card of cards"&gt;
      &lt;div class="open-close-container" (click)="test(card)"&gt;
        &lt;div *ngIf="card.isOpen"&gt;test&lt;/div&gt;
        &lt;div *ngIf="!card.isOpen"&gt;shidsfsdfsdf&lt;br&gt;t&lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>ts</p>
  
  <pre><code> cards = [{name:'div1',id: 1,isOpen: false},{name:'div2',id: 1 ,isOpen: false},{name:'div1',id: 2,isOpen: false},{name:'div2',id: 3 ,isOpen: false}];
  
    test(q){
      console.log(q)
          q.isOpen = !q.isOpen
    }
  </code></pre>
  
  <p>Here is the <a href="https://stackblitz.com/edit/angular-adjxmb?file=src%2Fapp%2Fapp.component.html" rel="nofollow noreferrer">stackblitz</a></p>