My element list appears like this:
<ul *ngFor="let period of periodsDate">
<li
[class.show]="isShown" (click)="toggleClass()">
<a>{{ period.id }} </a>
</li>
</ul>
To add or remove the 'show' class, I utilize the following method:
toggleClass() {
this.isShown = !this.isShown;
}
The issue at hand is that when clicking on any <li>
element, the 'show' class is added to all elements.
I aim to only have the 'show' class added to the specific <li>
that was clicked.