ncuillery / angular-breadcrumb

Generate a breadcrumb from ui-router's states
http://ncuillery.github.io/angular-breadcrumb/
MIT License
785 stars 183 forks source link

State options #72

Open TheCodeDestroyer opened 9 years ago

TheCodeDestroyer commented 9 years ago

Hey!

I was wondering is there a way that some state options could be passed in? Example:

ncyBreadcrumb: {
    stateOptions: {
        reload: true    
    }
}

That would be very awesome...

ncuillery commented 9 years ago

Hi,

Does it fit to your needs ? https://github.com/angular-ui/ui-router/wiki#attach-custom-data-to-state-objects

TheCodeDestroyer commented 9 years ago

Hey!

Sorry for late reply. Regarding the options, I'm not sure if we understood each other, what I meant by state options was: Example:

ncyBreadcrumb: {
    stateOptions: {
        reload: true    
    }
}

If we have this config, then this would be passed into $state.go() function or to ui-sref-opts directive.

So like in example above if I wanted to reload my state the call in backend would be

$state.go('state name', {}, ncyBreadcrumb.stateOptions) <- which has reload: true property inside

Hope I was more clear this time :)

TheCodeDestroyer commented 9 years ago

I see in the source that you are actually calling $state.href() method, which sadly doesn't have many options. Is there a particular reason for this method, instead of .go() or transitionTo()?

piernik commented 9 years ago

I also need stateOptions.reload. Here's my situation: https://github.com/angular-ui/ui-router/issues/1791 With reload: true I could fix problem in no time.

jondthompson commented 9 years ago

Bump. I need this too.

kasrakhosravi commented 9 years ago

Hey @ncuillery, Thanks for the great lib. I also need the state option for breadcrumb since I want to have the reload option. Should I start working on it and send a PR or is it something you are currently working on right now?

ncuillery commented 9 years ago

Hi,

As you can see in history, I lack time to maintain this module. I don't have work in progress. PR are greatly welcome :smile:

kasrakhosravi commented 9 years ago

I see ;) Using this library can solve your problems with stateOptions

https://github.com/ravaj-group/angular-ui-breadcrumb

joannadal commented 4 years ago

I am not sure if you still have the problem @TheCodeDestroyer but I found a solution. You just have to use this line for the tag <a> on the breadcrumbs template:

<a ng-switch-when="false" href="{{step.ncyBreadcrumbLink}}" ui-sref="{{ step.ncyBreadcrumbStateRef }}" ui-sref-opts="{reload: true, absolute: true}" ng-bind-html="step.ncyBreadcrumbLabel"></a>

The key is use the value of step.ncyBreadcrumbStateRef to build the ui-sref with the ui-sref-opts.