var app = angular.module('plunker', []);
app.controller('NavCtrl', function($scope, $location) {
$scope.isActive = function(route) {
$scope.path = $location.path();
return $location.path() === route;
};
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<link href="style.css" rel="stylesheet" />
<script data-semver="1.2.7" src="http://code.angularjs.org/1.2.7/angular.js" data-require="angular.js@1.2.x"></script>
<script src="app.js"></script>
</head>
<body ng-app="plunker" ng-controller="NavCtrl">
<p>Click one of the following choices.</p>
<ul>
<li ng-class="{active: isActive('/tab1')}"><a href="#/tab1">tab 1</a></li>
<li ng-class="{active: isActive('/tab2')}"><a href="#/tab2">tab 2</a></li>
</ul>
<pre>{{ path }}</pre>
</body>
</html>
/* Put your css in here */
.active {
background: gray;
color: white;
}