on view
<a ng-class="getClass("https://stackoverflow.com/tasks")" href="https://stackoverflow.com/tasks">Tasks</a>
on controller
$scope.getClass = function (path) {
return ($location.path().substr(0, path.length) === path) ? 'active' : '';
}
With this the tasks link will have the active class in any url that starts with “https://stackoverflow.com/tasks”(e.g. ‘/tasks/1/reports’)