I didn't know how to properly formulate my question so I'll try to explain myself here :
In my Angular 7 app, I have a navbar with icons as menu items.
On click, I want them to get a certain class, and the class has to disapear 2 seconds later.
I have 7 elements, here's 2 as an example :
<li class="fushia-icon">
<a routerLink="/savoir" routerLinkActive="fushia-icon-active" class="animated"
[class.flip]="this.iconIsClicked" (click)="iconClicked(this.iconIsClicked = true)">
</a>
</li>
<li class="beige-icon">
<a routerLink="/diplomes" routerLinkActive="beige-icon-active" class="animated"
[class.flip]="this.iconIsClicked" (click)="iconClicked(this.iconIsClicked = true)">
</a>
</li>
In my ts file I did this :
iconClicked(icon){
setTimeout(()=> {
icon = false
}, 2000)
}
But that doesnt do what I want at all since they both get the class, and the iconIsClicked value doesnt return to the element to be analysed (obvious).
I know I could create 7 functions with 7 variables so that each icon has its own stuff, but I'm looking for a quicker way without duplicating code.
Thank