Created
September 24, 2014 21:19
-
-
Save siddharth-pandey/87d5af6288ebdb32657a to your computer and use it in GitHub Desktop.
breadcrumbs angularjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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