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

Encapsulate the target (destination) state/params/options of a Transition.

This class is frequently used to redirect a transition to a new destination.

See:

To create a TargetState, use StateService.target.


This class wraps:

1) an identifier for a state 2) a set of parameters 3) and transition options 4) the registered state object (the StateDeclaration)

Many UI-Router APIs such as StateService.go take a StateOrName argument which can either be a state object (a StateDeclaration or StateObject) or a state name (a string). The TargetState class normalizes those options.

A TargetState may be valid (the state being targeted exists in the registry) or invalid (the state being targeted is not registered).

Hierarchy

  • TargetState

Index

Methods

$state

  • The internal state object (if it was found)

    Returns StateObject

error

  • error(): string
  • If the object is invalid, returns the reason why

    Returns string

exists

  • exists(): boolean
  • True if the target state was found

    Returns boolean

identifier

  • The identifier used when creating this TargetState

    Returns StateOrName

name

  • name(): string
  • The name of the state this object targets

    Returns string

options

  • The target options

    Returns TransitionOptions

params

  • The target parameter values

    Returns RawParams

state

  • The internal state declaration (if it was found)

    Returns StateDeclaration

toString

  • toString(): string
  • Returns string

valid

  • valid(): boolean
  • True if the object is valid

    Returns boolean

withOptions

  • Returns a copy of this TargetState, using the specified Transition Options.

    Parameters

    • options: TransitionOptions

      the new options to use

    • Default value replace: boolean = false

      When false (default) the new options will be merged with the current options. When true the options will be used instead of the current options.

    Returns TargetState

withParams

  • Returns a copy of this TargetState, using the specified parameter values.

    Parameters

    • params: RawParams

      the new parameter values to use

    • Default value replace: boolean = false

      When false (default) the new parameter values will be merged with the current values. When true the parameter values will be used instead of the current values.

    Returns TargetState

withState

  • Returns a copy of this TargetState which targets a different state. The new TargetState has the same parameter values and transition options.

    Parameters

    • state: StateOrName

      The new state that should be targeted

    Returns TargetState

Static isDef

  • isDef(obj: any): obj is TargetStateDef
  • Returns true if the object has a state property that might be a state or state name

    Parameters

    • obj: any

    Returns obj is TargetStateDef

Generated using TypeDoc