HTML
<div class="div2" *ngFor="let row of customer" (click)="showMessege(row.jobid)" [style.class.secondary]="changecolor">
<h3>ID : {{row.jobid}} </h3>
<p>Date : {{date}}</p>
</div>
In .ts file
changecolor = false
showMessege(ids:string){
this.id = ids
console.log(id)
this.shared.travelID(id)
this.changecolor = true
this.shared.notiCount(0)
}
.css
.secondary {
background-color: red
}
Result should be change background color from nothing to red if I click on each div.
But now if I click on some div it all red at the same time even some div is not clicked.
In this example it's changed to grey each row if clicked https://stackblitz.com/edit/angular-xd3yss
I try to change div to table but I still all red even don't clicked.