Transition | UI-Router
Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Transition

The representation of a transition between two states.

Contains all contextual information about the to/from states, parameters, resolves, as well as the list of states being entered and exited as a result of this transition.

Hierarchy

  • Transition

Implements

Index

Constructors

  • Creates a new Transition object.

    If the target state is not valid, an error is thrown.

    Parameters

    • fromPath: Node[]
      :

      The path of Nodes from which the transition is leaving. The last node in the fromPath encapsulates the "from state".

    • targetState: TargetState
      :

      The target state and parameters being transitioned to (also, the transition options)

    • _transitionService: TransitionService
      :

      The Transition Service instance

    Returns Transition


Properties

$id: number
_deferred: any
_transitionService: TransitionService

The Transition Service instance

The Transition Service instance

_treeChanges: TreeChanges
getHooks: IHookGetter
onBefore: IHookRegistration

Registers a callback function as an onBefore Transition Hook

Registers a callback function as an onBefore Transition Hook

The hook is only registered for this specific Transition. For global hooks, use TransitionService.onBefore

See IHookRegistry.onBefore

onEnter: IHookRegistration

Registers a callback function as an onEnter State Hook

Registers a callback function as an onEnter State Hook

The hook is only registered for this specific Transition. For global hooks, use TransitionService.onEnter

See IHookRegistry.onEnter

onError: IHookRegistration

Registers a callback function as an onError Transition Hook

Registers a callback function as an onError Transition Hook

The hook is only registered for this specific Transition. For global hooks, use TransitionService.onError

See IHookRegistry.onError

onExit: IHookRegistration

Registers a callback function as an onExit State Hook

Registers a callback function as an onExit State Hook

The hook is only registered for this specific Transition. For global hooks, use TransitionService.onExit

See IHookRegistry.onExit

onFinish: IHookRegistration

Registers a callback function as an onFinish Transition Hook

Registers a callback function as an onFinish Transition Hook

The hook is only registered for this specific Transition. For global hooks, use TransitionService.onFinish

See IHookRegistry.onFinish

onRetain: IHookRegistration

Registers a callback function as an onRetain State Hook

Registers a callback function as an onRetain State Hook

The hook is only registered for this specific Transition. For global hooks, use TransitionService.onRetain

See IHookRegistry.onRetain

onStart: IHookRegistration

Registers a callback function as an onStart Transition Hook

Registers a callback function as an onStart Transition Hook

The hook is only registered for this specific Transition. For global hooks, use TransitionService.onStart

See IHookRegistry.onStart

onSuccess: IHookRegistration

Registers a callback function as an onSuccess Transition Hook

Registers a callback function as an onSuccess Transition Hook

The hook is only registered for this specific Transition. For global hooks, use TransitionService.onSuccess

See IHookRegistry.onSuccess

promise: Promise<any>

This promise is resolved or rejected based on the outcome of the Transition.

This promise is resolved or rejected based on the outcome of the Transition.

When the transition is successful, the promise is resolved When the transition is unsuccessful, the promise is rejected with the TransitionRejection or javascript error

Methods

  • addResolves(resolves: object, state?: StateOrName): void
  • Adds new resolves to this transition.

  • Adds new resolves to this transition.

    Parameters

    • resolves: object
      :

      an [[ResolveDeclarations]] object which describes the new resolves

      • [key: string]: Function
    • state Default value: StateOrName = ""
      :

      the state in the "to path" which should receive the new resolves (otherwise, the root state)

    Returns void


  • dynamic(): boolean
  • Returns true if the transition is dynamic.

  • Returns true if the transition is dynamic.

    A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed.

    Returns boolean

    :

    true if the Transition is dynamic


  • error(): string
  • The reason the Transition is invalid

  • The reason the Transition is invalid

    Returns string

    :

    an error message explaining why the transition is invalid


  • ignored(): boolean
  • Returns true if the transition is ignored.

  • Returns true if the transition is ignored.

    A transition is ignored if no states are entered nor exited, and no parameter values have changed.

    Returns boolean

    :

    true if the Transition is ignored.


  • is(compare: Transition | object): boolean
  • Determines whether two transitions are equivalent.

  • isActive(): boolean
  • params(pathname?: string): object
  • Gets transition parameter values

  • Gets transition parameter values

    Parameters

    • pathname Default value: string = "to"
      :

      Pick which treeChanges path to get parameters for: ('to', 'from', 'entering', 'exiting', 'retained')

    Returns object

    :

    transition parameter values for the desired path.

    • [key: string]: any

  • previous(): Transition
  • Gets the previous transition, from which this transition was redirected.

  • Gets the previous transition, from which this transition was redirected.

    Returns Transition

    :

    The previous Transition, or null if this Transition is not the result of a redirection


  • ngdoc

    function

    name

    ui.router.state.type:Transition#redirect

    methodof

    ui.router.state.type:Transition

    description

    Creates a new transition that is a redirection of the current one. This transition can be returned from a $transitionsProvider hook, $state event, or other method, to redirect a transition to a new state and/or set of parameters.

    Parameters

    Returns Transition

    :

    Returns a new Transition instance.


  • resolves(): object
  • Get resolved data

  • Get resolved data

    Returns object

    :

    an object (key/value pairs) where keys are resolve names and values are any settled resolve data, or undefined for pending resolve data

    • [resolveName: string]: any

  • Gets the states being retained.

    Returns StateDeclaration[]

    :

    an array of states that are already entered from a previous Transition, that will not be exited during this Transition


  • run(): Promise<any>
  • Runs the transition

  • toString(): string
  • A string representation of the Transition

  • A string representation of the Transition

    Returns string

    :

    A string representation of the Transition


  • valid(): boolean
  • Checks if the Transition is valid

  • Get the ViewConfigs associated with this Transition

    Each state can define one or more views (template/controller), which are encapsulated as ViewConfig objects. This method fetches the ViewConfigs for a given path in the Transition (e.g., "to" or "entering").

    Parameters

    • pathname Default value: string = "entering"
      :

      the name of the path to fetch views for: ('to', 'from', 'entering', 'exiting', 'retained')

    • state Optional: State
      :

      If provided, only returns the ViewConfigs for a single state in the path

    Returns ViewConfig[]

    :

    a list of ViewConfig objects for the given path.


Generated using TypeDoc