You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using this.router.getPlugin('stickystates').exitSticky() to exit all inactive sticky states. This option enables you to exit a specific state as well.
If that's all correct, this means that to exit a sticky state it has to first be inactive, which makes sense. What this also means is that in order to exit a sticky state you have to redirect to another state even if that sticky state is already inactive. This case creates a problem.
Test Scenario
Let's say we have 2 states: app.normal-state and app.sticky-state, which as the name implies the app.sticky-state is a sticky: true state.
The user is currently on app.sticky-state and there's a close button which should take him to app.normal-state. This scenario requires that after closing, the inactive sticky state should be exited.
If the first option is used (this.router.stateService.go('app.normal-state', {}, {exitSticky: 'app.sticky-state'})) it won't work since app.sticky-state is not inactive.
If the second option is used (this.router.getPlugin('stickystates').exitSticky()) by having some timeout after the state successfully transitions, the following API code will trigger:
exitSticky(states?: any) {
let $state = this.router.stateService;
if (states === undefined) states = this._inactives.map(node => node.state.name);
if (isString(states)) states = [states];
return $state.go($state.current, {}, {
inherit: true,
exitSticky: states
});
}
This code will not work as the $state.go will redirect to the current state which will not have any effect. A reload: true would trigger an effect.
The problem here is that in order to exit a sticky state, one has to transition to another state. This is not always the case. It would be best to have an option which just exits inactive sticky states without transitioning to a new state. On the previous UIRouterExtras project this was possible using this.$stickyState.reset('*').
The text was updated successfully, but these errors were encountered:
The code previously didn't allow exitSticky for a state that is currently active, but is scheduled to be inactivated during the new transition. This should be fixed now.
Having an issue when exiting a sticky state. Currently the API offers two options to exit a Sticky State (correct me if I'm wrong).
First Option:
Setting an
exitState
property when redirecting to another state.Example:
this.router.stateService.go('app.new-state', {}, {exitSticky: 'app.sticky-state'})
Second Option
Using
this.router.getPlugin('stickystates').exitSticky()
to exit all inactive sticky states. This option enables you to exit a specific state as well.If that's all correct, this means that to exit a sticky state it has to first be inactive, which makes sense. What this also means is that in order to exit a sticky state you have to redirect to another state even if that sticky state is already inactive. This case creates a problem.
Test Scenario
Let's say we have 2 states:
app.normal-state
andapp.sticky-state
, which as the name implies theapp.sticky-state
is asticky: true
state.The user is currently on
app.sticky-state
and there's a close button which should take him toapp.normal-state
. This scenario requires that after closing, the inactive sticky state should be exited.If the first option is used (
this.router.stateService.go('app.normal-state', {}, {exitSticky: 'app.sticky-state'})
) it won't work sinceapp.sticky-state
is not inactive.If the second option is used (
this.router.getPlugin('stickystates').exitSticky()
) by having some timeout after the state successfully transitions, the following API code will trigger:This code will not work as the
$state.go
will redirect to the current state which will not have any effect. Areload: true
would trigger an effect.The problem here is that in order to exit a sticky state, one has to transition to another state. This is not always the case. It would be best to have an option which just exits inactive sticky states without transitioning to a new state. On the previous UIRouterExtras project this was possible using
this.$stickyState.reset('*')
.The text was updated successfully, but these errors were encountered: