I am encountering a situation where I have some repeated 'li' elements, and some of them are assigned the 'active' class based on certain conditions.
<li ng-repeat="menuSubItem in menuItem.items" ng-class="{active: vm.currentMenuName == menuSubItem.name}" active-collapsible>
On the other hand, I have created a directive that is intended to apply additional classes depending on the presence of the 'active' class. My directive looks like this:
directive('activeCollapsible', function() {
return {
restrict: 'A',
link: function($scope, element, attrs) {
}
}
});
However, I am facing an issue as I do not see the 'active' class in the 'element' argument. (I have already included jQuery before Angular.)
$(element).hasClass('active')
Is there a way for me to access the 'active' class within my directive?