hooks | @uirouter/angularjs
Options
Menu

Module hooks

Index

Variables

onEnterHook: TransitionStateHookFn = makeEnterExitRetainHook('onEnter')

The TransitionStateHookFn for onEnter

The TransitionStateHookFn for onEnter

When the state is being entered, the state's .onEnter function is invoked.

Registered using transitionService.onEnter({ entering: (state) => !!state.onEnter }, onEnterHook);

See: IHookRegistry.onEnter

onExitHook: TransitionStateHookFn = makeEnterExitRetainHook('onExit')

The TransitionStateHookFn for onExit

The TransitionStateHookFn for onExit

When the state is being exited, the state's .onExit function is invoked.

Registered using transitionService.onExit({ exiting: (state) => !!state.onExit }, onExitHook);

See: IHookRegistry.onExit

onRetainHook: TransitionStateHookFn = makeEnterExitRetainHook('onRetain')

The TransitionStateHookFn for onRetain

The TransitionStateHookFn for onRetain

When the state was already entered, and is not being exited or re-entered, the state's .onRetain function is invoked.

Registered using transitionService.onRetain({ retained: (state) => !!state.onRetain }, onRetainHook);

See: IHookRegistry.onRetain

Functions

  • A TransitionHookFn which activates the new views when a transition is successful.

    Registered using transitionService.onSuccess({}, activateViews);

    After a transition is complete, this hook deactivates the old views from the previous state, and activates the new views from the destination state.

    See ViewService

    Parameters

    Returns void


  • A TransitionHookFn that skips a transition if it should be ignored

    This hook is invoked at the end of the onBefore phase.

    If the transition should be ignored (because no parameter or states changed) then the transition is ignored and not processed.

    Parameters

    Returns Promise<any>


  • A TransitionHookFn that performs lazy loading

    When entering a state "abc" which has a lazyLoad function defined:

    • Invoke the lazyLoad function (unless it is already in process)
      • Flag the hook function as "in process"
      • The function should return a promise (that resolves when lazy loading is complete)
    • Wait for the promise to settle
      • If the promise resolves to a LazyLoadResult, then register those states
      • Flag the hook function as "not in process"
    • If the hook was successful
      • Remove the lazyLoad function from the state declaration
    • If all the hooks were successful
      • Retry the transition (by returning a TargetState)
    .state('abc', {
      component: 'fooComponent',
      lazyLoad: () => System.import('./fooComponent')
      });
    

    See StateDeclaration.lazyLoad

    Parameters

    Returns Promise<TargetState>


  • A TransitionHookFn which waits for the views to load

    Registered using transitionService.onStart({}, loadEnteringViews);

    Allows the views to do async work in ViewConfig.load before the transition continues. In angular 1, this includes loading the templates.

    Parameters

    Returns Promise<any>


Generated using TypeDoc