I am having trouble working out how to get a class to change on a nested directive.
This is the outer ng-repeat
<div data-courseoverview data-ng-repeat="course in courses | orderBy:sortOrder | filter:search"
data-ng-controller ="CourseItemController"
data-ng-class="{ selected: isSelected }">
Below is the inner ng-repeat which is using another directive
<li data-ng-repeat="item in social" class="social-{{item.name}}" ng-mouseover="hoverItem(true);"
ng-mouseout="hoverItem(false);"
index="{{$index}}"><i class="{{item.icon}}"
box="course-{{$index}}"></i></li>
Here is the directive im calling for the hover event
ecourseApp.directive("courseoverview", function() {
return {
restrict : 'A',
replace: true,
/*scope: {
index: '@'
},*/
transclude: true,
templateUrl: "views/course-overview.html",
link: function link(scope, element, attrs) {
scope.switched = false;
//hover handler
scope.hoverItem = function(hovered){
if (hovered) {
element.addClass('hover');
$('#course-0 figure').addClass('tint')
}
else
element.removeClass('hover');
};
}
}});
This needs $('#course-0 figure').addClass('tint')
to change the calling item.