I encountered an issue within my app
<li ng-repeat="name in tabs track by $index" ng-class="{selected: tab==$index}" ng-click="tab = $index">{{name}}</li>
After clicking on each item, the selected class remains enabled and switching to another item does not remove the class or update the tab. It only works when I make use of:
<li ng-repeat="name in tabs track by $index" ng-class="{selected: tab==$index}" ng-click="switchTab($index)">{{name}}</li>
scope.switchTab = function(index) {
scope.tab = index;
};
I am wondering why ng-click="tab = $index"
is not functioning as expected.