Highlight a current menu item in Angular js using ng-class

HTML:-
<a ng-class="isAtive('/about')" href="/about">About</a>
Controller js:-
$scope.isAtive= function (path) {
  return ($location.path() === path) ? 'active' : '';
}
With this the tasks link will have the active class in any url that starts with '/about'
Share on Google Plus

About Amit

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment