Skip to content

Instantly share code, notes, and snippets.

@n0m4dz
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n0m4dz/f4b9555ea9ef54001573 to your computer and use it in GitHub Desktop.
Save n0m4dz/f4b9555ea9ef54001573 to your computer and use it in GitHub Desktop.
Angular current navigation highlight
'use strict'
app = angular.module 'app', []
app.run(($scope, $location)->
$scope.isActive = (path)->
if ($location.path().substr(0, path.length) is path)
if (path is "/" && $location.path() is "/")
return true
if (path is "/")
return false
return true
else
return false
return
)
(function() {
'use strict';
var app;
app = angular.module('app', []);
app.run(function($scope, $location) {
$scope.isActive = function(path) {
if ($location.path().substr(0, path.length) === path) {
if (path === "/" && $location.path() === "/") {
return true;
}
if (path === "/") {
return false;
}
return true;
} else {
return false;
}
};
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment