Skip to content

Instantly share code, notes, and snippets.

@kevinwestern
Created January 13, 2013 20:07
Show Gist options
  • Save kevinwestern/4525925 to your computer and use it in GitHub Desktop.
Save kevinwestern/4525925 to your computer and use it in GitHub Desktop.
Angular navigation
/** NavController */
'use strict';
testnavApp.controller('NavController', function($scope, $location) {
$scope.isActiveTab = function(tab) {
return $location.path().indexOf(tab) !== -1;
};
});
/** html **/
<ul class="nav" ng-controller="NavController">
<li>
<a href="#/people" ng-class="{active: isActiveTab('people')}">People</a>
</li>
<li>
<a href="#/places" ng-class="{active: isActiveTab('places')}">Places</a>
</li>
<li>
<a href="#/things" ng-class="{active: isActiveTab('things')}">Things</a>
</li>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment