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

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

See:

- HookResult
- TransitionHookFn
- TransitionService.onStart

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

### Constructors

- constructor

### Properties

- _definition
- _identifier
- _options
- _params
- _stateRegistry

### Methods

- $state
- error
- exists
- identifier
- name
- options
- params
- state
- toString
- valid
- withOptions
- withParams
- withState
- isDef

## Constructors

- new TargetState(_stateRegistry: StateRegistry, _identifier: StateOrName, _params?: RawParams, _options?: TransitionOptions): TargetState

- The TargetState constructor

- The TargetState constructor

  Note: Do not construct a `TargetState` manually. To create a `TargetState`, use the StateService.target factory method.

  #### Parameters

  - ##### _stateRegistry StateRegistry

    :

    The StateRegistry to use to look up the _definition

  - ##### _identifier StateOrName

    :

    An identifier for a state. Either a fully-qualified state name, or the object used to define the state.

  - ##### _params: Optional RawParams

    :

    Parameters for the target state

  - ##### _options: Optional TransitionOptions

    :

    Transition options.

  #### Returns TargetState

  - Defined in state/targetState.ts:51

## Properties

_definition: StateObject

- Defined in state/targetState.ts:45

_identifier: StateOrName

An identifier for a state. Either a fully-qualified state name, or the object used to define the state.

An identifier for a state. Either a fully-qualified state name, or the object used to define the state.

- Defined in state/targetState.ts:69

_options: TransitionOptions

- Defined in state/targetState.ts:47

_params: RawParams

- Defined in state/targetState.ts:46

_stateRegistry: StateRegistry

The StateRegistry to use to look up the _definition

The StateRegistry to use to look up the _definition

- Defined in state/targetState.ts:68

## Methods

- $state(): StateObject

- The internal state object (if it was found)

- The internal state object (if it was found)

  #### Returns StateObject

  - Defined in state/targetState.ts:95

- error(): string

- If the object is invalid, returns the reason why

- If the object is invalid, returns the reason why

  #### Returns string

  - Defined in state/targetState.ts:120

- exists(): boolean

- True if the target state was found

- True if the target state was found

  #### Returns boolean

  - Defined in state/targetState.ts:110

- identifier(): StateOrName

- The identifier used when creating this TargetState

- The identifier used when creating this TargetState

  #### Returns StateOrName

  - Defined in state/targetState.ts:85

- name(): string

- The name of the state this object targets

- The name of the state this object targets

  #### Returns string

  - Defined in state/targetState.ts:80

- options(): TransitionOptions

- The target options

- The target options

  #### Returns TransitionOptions

  - Defined in state/targetState.ts:105

- params(): RawParams

- The target parameter values

- The target parameter values

  #### Returns RawParams

  - Defined in state/targetState.ts:90

- state(): StateDeclaration

- The internal state declaration (if it was found)

- The internal state declaration (if it was found)

  #### Returns StateDeclaration

  - Defined in state/targetState.ts:100

- toString(): string

- #### Returns string

  - Defined in state/targetState.ts:132

- valid(): boolean

- True if the object is valid

- True if the object is valid

  #### Returns boolean

  - Defined in state/targetState.ts:115

- withOptions(options: TransitionOptions, replace?: boolean): TargetState

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

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

  #### Parameters

  - ##### options TransitionOptions

    :

    the new options to use

  - ##### replace: Default value 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

  - Defined in state/targetState.ts:165

- withParams(params: RawParams, replace?: boolean): TargetState

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

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

  #### Parameters

  - ##### params RawParams

    :

    the new parameter values to use

  - ##### replace: Default value 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

  - Defined in state/targetState.ts:153

- withState(state: StateOrName): TargetState

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

- 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

  - Defined in state/targetState.ts:142

- isDef(obj: any): boolean

- Returns true if the object has a state property that might be a state or state name

- Returns true if the object has a state property that might be a state or state name

  #### Parameters

  - ##### obj any

  #### Returns boolean

  - Defined in state/targetState.ts:50

Generated using TypeDoc