I need assistance with dynamically adding and removing a class from a clicked element in AngularJS.
Here is an example of my code:
<li ng-repeat='test in tests' >
<a href='' ng-click='pickTest($index, $event)'>{{test.title}}</a>
</li>
Here is my JavaScript:
$scope.pickTest = function(index, event) {
$(event.target).addClass('blur');
//This code successfully adds the class 'blur' when an <a> tag is clicked
//Now, I need to remove the class when another <a> tag is clicked
};
Can anyone provide guidance on how to achieve this functionality?
Thank you!