given a ionic2 app that renders a ion-list with ion-item elements in it, what’s the recommended way to highlight the selected element of the list, which is, the element the user last clicked?
my plan was to to use the (click) callback and maintain a selectedIndex in my component, and then do something like this:
<ion-item *ngFor="let track of list; let idx = index" (click)="onItemClicked(idx)" class="idx===currentSelected ? 'selected' : null"> ... </ion-item>
whereby the .selected is defined in the scss.
however it did not work (the click event handling works fine, but the color stays unchanged)
i also tried “ngClass” and played with “[color]”, but non worked.
interestingly, the hover-effect worked right away using this scss:
but the feature to prominently highlight the selected item (ie. the item which the user last clicked) is even more important but i could not achieve it yet.
==> any hints or pointers to relevant docu would be greatly appreciated! thanks!