I have a list of things that I display with ngrepeat
that when they are clicked, produce an additional list of things pertaining to the element selected. My intent is to have the clicked element's background change color so as to show it selected. My issue is when I select another element, they both show as selected. Here is my code:
<div class="breakdownRow pointer" ng-class="{bSelection: selection}" ng-click="selection=true" ng-repeat="m in masterList">
<span class="areaTag">{{m.area}}</span>
<span class="storeNumTag" ng-repeat="v in m.valueList track by $index">{{v.toLocaleString()}} </span>
</div>
As noted before, the first click event works great. bSelection is my css class that has the changing of the background color. Again my issue is that once another element is clicked, the previous doesn't "unselect" per se.
Question: How do I un-give a class to an element when another element has been selected so that only one shows as highlighted at a time?