I have an ng-repeat for a table, I want to be able to add a class when
Right now there is a single And in the is clicked, and remove the class when un-clicked. Multiple >
clicked property on the scope that you're changing and everything refers to that. Try to put clicked on the node instead...$scope.toggleMe = function(node) {
if ($scope.count > 0) {
angular.forEach($scope.cityArr, function(value) {
if (node.city === value) {
node.clicked = false;
} else {
$scope.cityArr.push(node.city);
node.clicked = true;
}
});
} else {
$scope.cityArr.push(node.city);
node.clicked = true;
}
$scope.count = 1;
};
ngRepeat...
{{node.name}}
{{node.date}}
{{node.city}}