TransitionHook | @uirouter/angular
Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • TransitionHook

Index

Constructors

constructor

Properties

type

Methods

handleHookResult

  • This method handles the return value of a Transition Hook.

    A hook can return false (cancel), a TargetState (redirect), or a promise (which may later resolve to false or a redirect)

    This also handles "transition superseded" -- when a new transition was started while the hook was still running

    Parameters

    Returns Promise<HookResult>

invokeHook

  • Returns Promise<HookResult> | void

logError

  • logError(err: any): any
  • Parameters

    • err: any

    Returns any

toString

  • toString(): string
  • Returns string

Static HANDLE_RESULT

  • These GetResultHandler(s) are used by invokeHook below Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]])

    Parameters

    Returns (Anonymous function)

Static LOG_ERROR

  • These GetErrorHandler(s) are used by invokeHook below Each HookType chooses a GetErrorHandler (See: [[TransitionService._defineCoreEvents]])

    Parameters

    Returns (Anonymous function)

Static LOG_REJECTED_RESULT

  • If the result is a promise rejection, log it. Otherwise, ignore the result.

    Parameters

    Returns (Anonymous function)

Static REJECT_ERROR

  • Parameters

    Returns (Anonymous function)

Static THROW_ERROR

  • Parameters

    Returns (Anonymous function)

Static chain

  • Chains together an array of TransitionHooks.

    Given a list of TransitionHook objects, chains them together. Each hook is invoked after the previous one completes.

    Example:

    var hooks: TransitionHook[] = getHooks();
    let promise: Promise<any> = TransitionHook.chain(hooks);
    
    promise.then(handleSuccess, handleError);

    Parameters

    • hooks: TransitionHook[]

      the list of hooks to chain together

    • Optional waitFor: Promise<any>

      if provided, the chain is .then()'ed off this promise

    Returns Promise<any>

    a Promise for sequentially invoking the hooks (in order)

Static invokeHooks

  • Invokes all the provided TransitionHooks, in order. Each hook's return value is checked. If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned. If no hook returns a promise, then all hooks are processed synchronously.

    Type parameters

    • T

    Parameters

    • hooks: TransitionHook[]

      the list of TransitionHooks to invoke

    • doneCallback: (result?: HookResult) => T

      a callback that is invoked after all the hooks have successfully completed

    Returns Promise<any> | T

    a promise for the async result, or the result of the callback

Static runAllHooks

  • Run all TransitionHooks, ignoring their return value.

    Parameters

    Returns void

Generated using TypeDoc