In order to select and style a specific element within a nested directive, it is necessary to have a method of isolating that particular element. Merely using the :hover pseudo-class will not suffice, so binding certain events can help resolve this issue. Below is an example directive that achieves this:
app.directive('directiveExample', function () {
return {
restrict: 'E',
transclude: true,
// Wrapping content
template: '<div class="container-directive" ng-transclude></div>',
link: function (scope, element, attr) {
element.bind('mouseover', function(ev) {
ev.stopPropagation();
var wrappers = angular.element(document.getElementsByClassName('container-directive'));
angular.forEach(wrappers, function(value, key) {
angular.element(value).children('span').removeClass('active-element');
});
element.children('.container-directive').children('span').addClass('active-element');
});
}
}
});
You can view the complete plunker HERE.