From c12e7ead631cbad6d77eb50d005ad356ffe105dd Mon Sep 17 00:00:00 2001 From: hmbl9r Date: Wed, 16 Sep 2015 16:03:22 -0700 Subject: [PATCH] add ncyBreadcrumbGetLink function to step object add ncyBreadcrumbGetLink function to step object so that if your parent state params are not available right when the page loads, you can still have them available when the page is done loading --- src/angular-breadcrumb.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/angular-breadcrumb.js b/src/angular-breadcrumb.js index a8f1415..1e6994d 100644 --- a/src/angular-breadcrumb.js +++ b/src/angular-breadcrumb.js @@ -52,7 +52,6 @@ function $Breadcrumb() { // Add the state in the chain if not already in and if not abstract var $$addStateInChain = function(chain, stateRef) { var conf, - parentParams, ref = parseStateRef(stateRef), force = false, skip = false; @@ -70,11 +69,16 @@ function $Breadcrumb() { if(conf.ncyBreadcrumb.skip){ skip = true; } } if((!conf.abstract || $$options.includeAbstract || force) && !skip) { - if(ref.paramExpr) { - parentParams = $lastViewScope.$eval(ref.paramExpr); - } + conf.ncyBreadcrumbGetLink = function() { + var parentParams; + if(ref.paramExpr) { + parentParams = $lastViewScope.$eval(ref.paramExpr); + } + + return $state.href(ref.state, parentParams || $stateParams || {}); + }; - conf.ncyBreadcrumbLink = $state.href(ref.state, parentParams || $stateParams || {}); + conf.ncyBreadcrumbLink = conf.ncyBreadcrumbGetLink(); chain.unshift(conf); } };