I created an isActive function to apply the active class to a menu element.
The function looks like this:
$scope.isActive = function (path) {
if (path == $location.path()) {
return true;
} else {
return false;
}
}
In my HTML, I simply use:
<li ng-class="{active: isActive('/page')}">
<a href="page">Page</a></li>
However, this specific HTML is only defined once in my template. It would be more convenient to use:
isActive('/page*')
This way, any URL path beyond '/page' will also receive the active state.
Has anyone discovered a workaround for this? I've searched forums and Angular documentation without success, so it seems this feature may not be available yet...