Skip to content

Instantly share code, notes, and snippets.

@siddharth-pandey
Created September 24, 2014 21:19
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 siddharth-pandey/87d5af6288ebdb32657a to your computer and use it in GitHub Desktop.
Save siddharth-pandey/87d5af6288ebdb32657a to your computer and use it in GitHub Desktop.
breadcrumbs angularjs
packagerApp.directive('breadcrumbs', function ($routeParams) {
return {
restrict: 'E',
controller: function ($scope) {
var rootUrl = "/Packager/Clients";
$scope.crumbs = [
{
url: rootUrl,
text: "Home"
}
];
var runningUrl = rootUrl;
for (var param in $routeParams) {
runningUrl += $routeParams[param];
$scope.crumbs.push({ url: runningUrl, text: $routeParams[param] });
}
$scope.notLast = function (crumb) {
return crumb !== _.last($scope.crumbs);
};
},
templateUrl: "/templates/breadcrumb.template.html"
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment