So I have got a parent component with children components binded over an ngFor()
such as:
<categories *ngFor= "let category of categories" [category]="category"></categories>
Each of this categories has a title text with an ngClass
like this one (being selected a variable I set to true in the children component when I click on it):
<h3 class="my-3 px-1 category" [ngClass]="{'category-selected':selected}">
{{ category.Title }}
</h3>
What I have been trying to do with little success is to turn this text green when you click on the category children element.
That works fine but my main issue is that whenever I click a second category after the first one, the first one still has the text set to green and I dont know how to set this text back to its original color when you click on a different category (i.e reset its color if the category is not selected).