I have X number of list items in an unordered list.
When a user clicks on one then I want to change the css/style of that list item (e.g. make the background yellow) and also remove the css/style of any other list item they might have clicked previously.
I currently have in each list item:
<li ng-repeat="filename in files" item="filename" ng-click="clicked(filename)">
"{{filename}}"
</li>
which calls:
$scope.clicked = function(filename){
alert('Clicked: ' + filename);
};
Normally I would just whip up some jQuery but I want to use the framework correctly.
So in the “clicked” function how do I iterate the unordered list and modify each item?
Thank you very much!