How to add class active to a menu with AngularJS

Now I was building a simple AngularJS site with a menu and ran into the problem of how to highlight the active menu item based on the url. After some research and trial and error I figured the best option is to use a directive. I would simply add an attribute to every list item I like to be watched…