I am trying to conditionally change the class of an element that is nested in an unordered list.
If you are not using ng-repeat to create a list, I can use the jqlite.children () selector to find the correct item and change the class.
However, I use ng-repeat to create the list, and I cannot figure out how to access the specific element of the list that I want..children () always returns undefined.
here is the jsfiddle of what i am trying to do http://jsfiddle.net/whitehead1415/ENtTC/3/
app.directive('myDirective1', function () { return { restrict: 'A', link: function ($scope, element, attrs, controller) {
I need to change a class based on two things
- when the user clicks on a specific element, the element should highlight
- when the user clicks the button, which is the next element, it will be highlighted (this button is not included in jsfiddle)
I was thinking about putting a directive in each element of the list, but the only problem is that I do not know how to make them all aware of each other, so that only one element is highlighted at a time
source share