Does AngularJS help in any way with setting an active class on the link for the current page?

I imagine there is some magical way this is done, but I can’t seem to find.

My menu looks like:

 <ul>
   <li><a class="active" href="https://stackoverflow.com/tasks">Tasks</a>
   <li><a href="http://stackoverflow.com/actions">Tasks</a>
 </ul>

and I have controllers for each of them in my routes: TasksController and ActionsController.

But I can’t figure out a way to bind the “active” class on the a links to the controllers.

Any hints?

29 Answers
29

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *