angular-breadcrumb icon indicating copy to clipboard operation
angular-breadcrumb copied to clipboard

State options

Open TheCodeDestroyer opened this issue 9 years ago • 9 comments

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...

TheCodeDestroyer avatar Feb 13 '15 13:02 TheCodeDestroyer

Hi,

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

ncuillery avatar Feb 13 '15 14:02 ncuillery

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 avatar Feb 15 '15 20:02 TheCodeDestroyer

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()?

TheCodeDestroyer avatar Feb 16 '15 07:02 TheCodeDestroyer

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.

piernik avatar Mar 03 '15 18:03 piernik

Bump. I need this too.

jondthompson avatar Apr 28 '15 18:04 jondthompson

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?

kasrakhosravi avatar Aug 02 '15 06:08 kasrakhosravi

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:

ncuillery avatar Aug 02 '15 08:08 ncuillery

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

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

kasrakhosravi avatar Aug 08 '15 13:08 kasrakhosravi

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.

joannadal avatar May 01 '20 16:05 joannadal