State hooks are registered as onEnter/onRetain/onExit in state
declarations. State hooks can additionally be injected with
$transitions and $states for the current [[Transition]] and
[[StateObject]] in the transition.
Transition State Hooks are callback functions that hook into the
lifecycle events of specific states during a transition. As a
transition runs, it may exit some states, retain (keep) states, and
enter states. As each lifecycle event occurs, the hooks which are
registered for the event and that state are called (in priority
order).
onExit: [ '$transition$', '$state', function($transition$, $state) { // always redirect to 'foo' state when being exited if ($transition$.to().name !== 'foo') { return$state.target('foo'); } } ]
The signature for State Transition Hooks.
State hooks are registered as onEnter/onRetain/onExit in state declarations. State hooks can additionally be injected with $transitions and $states for the current [[Transition]] and [[StateObject]] in the transition.
Transition State Hooks are callback functions that hook into the lifecycle events of specific states during a transition. As a transition runs, it may exit some states, retain (keep) states, and enter states. As each lifecycle event occurs, the hooks which are registered for the event and that state are called (in priority order).
See also:
Example:
Not minification-safe
Annotated for minification-safety