Angular multiple blocks on and off together

code looks like this,
https://stackblitz.com/edit/a...

what I want to do is to click and find all those with id, then turn their isOpen into true, and then switch with id

.

is there a way to do this?

ts

 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
  }

html

<div  *ngFor="let card of cards">
    <div class="open-close-container" (click)="test(card)">
      <div *ngIf="card.isOpen">test</div>
      <div *ngIf="!card.isOpen">shidsfsdfsdf<br>t</div>
    </div>
</div>
May.20,2022

you can't control everything with one tag. Because the tag is responsive, changing one of the components will change everything. It can be replaced by a flag array, or the object can be


A simpler way to write:

clipboard.png

Menu