Change the style of selected item in list in ngFor


#1

Hello,
i want to apply style dynamically on list when one item is selected.
i have a list of filters, once user select one from list, it should be highlighted.

i want to change style by item.selected property??
Does we have that type of functionality ??
Can anyone give me one example of that??

Thank you.


#2

You can do something like that

[ngClass]="{'item-selected' : item.selected}"

and apply the style at the item-selected class