I am facing an issue with a div that is being looped using ngFor. What I want to achieve is when a user clicks on one of the divs in the loop, only that particular div should change its text color. If another div is clicked, it should change color while the previously clicked div reverts back to its original color. How can I implement this functionality using Angular 2?
Here is an example:
<div *ngFor="let x of y; let i= index" (click)="changeColor()"></div>