Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "angular-breadcrumb",
"description": "AngularJS module that generates a breadcrumb from ui-router's states",
"version": "0.5.0",
"version": "0.5.2",
"main": "release/angular-breadcrumb.js",
"ignore": [
"sample",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "angular-breadcrumb",
"description": "AngularJS module that generates a breadcrumb from ui-router's states",
"version": "0.5.0",
"version": "0.5.2",
"homepage": "http://ncuillery.github.io/angular-breadcrumb",
"author": {
"name": "Nicolas Cuillery",
Expand Down
31 changes: 24 additions & 7 deletions release/angular-breadcrumb.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*! angular-breadcrumb - v0.5.0
* http://ncuillery.github.io/angular-breadcrumb
* Copyright (c) 2016 Nicolas Cuillery; Licensed MIT */

(function (window, angular, undefined) {
/*! angular-breadcrumb - v0.5.2
* http://ncuillery.github.io/angular-breadcrumb
* Copyright (c) 2016 Nicolas Cuillery; Licensed MIT */
(function (window, angular, undefined) {
'use strict';

function isAOlderThanB(scopeA, scopeB) {
Expand Down Expand Up @@ -114,6 +114,17 @@ function $Breadcrumb() {
return $$parentState(conf);
};

var $getValuesFromResolve = function($scopeContext) {
$scopeContext.resolvedValues = {};
if($scopeContext && $scopeContext.hasOwnProperty('$resolve')) {
angular.forEach($scopeContext.$resolve, function(promise, key) {
$scopeContext.resolvedValues[key] = promise;
});
}

return $scopeContext;
};

return {

getTemplate: function(templates) {
Expand Down Expand Up @@ -174,7 +185,9 @@ function $Breadcrumb() {

$getLastViewScope: function() {
return $lastViewScope;
}
},

$getValuesFromResolve: $getValuesFromResolve
};
}];
}
Expand Down Expand Up @@ -242,6 +255,8 @@ function BreadcrumbDirective($interpolate, $breadcrumb, $rootScope) {
labelWatchers = [];

var viewScope = $breadcrumb.$getLastViewScope();
viewScope = $breadcrumb.$resolveValues(viewScope);

scope.steps = $breadcrumb.getStatesChain();
angular.forEach(scope.steps, function (step) {
if (step.ncyBreadcrumb && step.ncyBreadcrumb.label) {
Expand Down Expand Up @@ -298,6 +313,7 @@ function BreadcrumbLastDirective($interpolate, $breadcrumb, $rootScope) {
labelWatchers = [];

var viewScope = $breadcrumb.$getLastViewScope();
viewScope = $breadcrumb.$resolveValues(viewScope);
var lastStep = $breadcrumb.getLastStep();
if(lastStep) {
scope.ncyBreadcrumbLink = lastStep.ncyBreadcrumbLink;
Expand Down Expand Up @@ -365,6 +381,7 @@ function BreadcrumbTextDirective($interpolate, $breadcrumb, $rootScope) {
labelWatchers = [];

var viewScope = $breadcrumb.$getLastViewScope();
viewScope = $breadcrumb.$resolveValues(viewScope);
var steps = $breadcrumb.getStatesChain();
var combinedLabels = [];
angular.forEach(steps, function (step) {
Expand Down Expand Up @@ -402,4 +419,4 @@ angular.module('ncy-angular-breadcrumb', ['ui.router.state'])
.directive('ncyBreadcrumb', BreadcrumbDirective)
.directive('ncyBreadcrumbLast', BreadcrumbLastDirective)
.directive('ncyBreadcrumbText', BreadcrumbTextDirective);
})(window, window.angular);
})(window, window.angular);
8 changes: 4 additions & 4 deletions release/angular-breadcrumb.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion src/angular-breadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,17 @@ function $Breadcrumb() {
return $$parentState(conf);
};

var $getValuesFromResolve = function($scopeContext) {
$scopeContext.resolvedValues = {};
if($scopeContext && $scopeContext.hasOwnProperty('$resolve')) {
angular.forEach($scopeContext.$resolve, function(promise, key) {
$scopeContext.resolvedValues[key] = promise;
});
}

return $scopeContext;
};

return {

getTemplate: function(templates) {
Expand Down Expand Up @@ -169,7 +180,9 @@ function $Breadcrumb() {

$getLastViewScope: function() {
return $lastViewScope;
}
},

$getValuesFromResolve: $getValuesFromResolve
};
}];
}
Expand Down Expand Up @@ -237,6 +250,8 @@ function BreadcrumbDirective($interpolate, $breadcrumb, $rootScope) {
labelWatchers = [];

var viewScope = $breadcrumb.$getLastViewScope();
viewScope = $breadcrumb.$resolveValues(viewScope);

scope.steps = $breadcrumb.getStatesChain();
angular.forEach(scope.steps, function (step) {
if (step.ncyBreadcrumb && step.ncyBreadcrumb.label) {
Expand Down Expand Up @@ -293,6 +308,7 @@ function BreadcrumbLastDirective($interpolate, $breadcrumb, $rootScope) {
labelWatchers = [];

var viewScope = $breadcrumb.$getLastViewScope();
viewScope = $breadcrumb.$resolveValues(viewScope);
var lastStep = $breadcrumb.getLastStep();
if(lastStep) {
scope.ncyBreadcrumbLink = lastStep.ncyBreadcrumbLink;
Expand Down Expand Up @@ -360,6 +376,7 @@ function BreadcrumbTextDirective($interpolate, $breadcrumb, $rootScope) {
labelWatchers = [];

var viewScope = $breadcrumb.$getLastViewScope();
viewScope = $breadcrumb.$resolveValues(viewScope);
var steps = $breadcrumb.getStatesChain();
var combinedLabels = [];
angular.forEach(steps, function (step) {
Expand Down