Skip to content

Instantly share code, notes, and snippets.

@codef0rmer
Created September 19, 2012 15:23
Show Gist options
  • Save codef0rmer/3750235 to your computer and use it in GitHub Desktop.
Save codef0rmer/3750235 to your computer and use it in GitHub Desktop.
Page Navigation Bar in Angular.js
var navList = angular.module('navList', []);
navList.controller('navCtrl', ['$scope', '$location', function ($scope, $location) {
$scope.navClass = function (page) {
var currentRoute = $location.path().substring(1) || 'home';
return page === currentRoute ? 'active' : '';
};
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment