I have this in my app:
<li ng-repeat="name in tabs track by $index" ng-class="{selected: tab==$index}" ng-click="tab = $index">{{name}}</li>
and it don't work, selected class is enabled when I click on the item (each li I click have this class and it's not removed when I click other li) and tab is not updating, it work when I use this:
<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;
};
why is this happening, why ng-click="tab = $index"
don't work?