Encapsulates Dependency Injection for a path of nodes

UI-Router states are organized as a tree. A nested state has a path of ancestors to the root of the tree. When a state is being activated, each element in the path is wrapped as a PathNode. A `PathNode` is a stateful object that holds things like parameters and resolvables for the state being activated.

The ResolveContext closes over the PathNodes, and provides DI for the last node in the path.

### Hierarchy

- ResolveContext

## Index

### Constructors

- constructor

### Properties

- _injector
- _path

### Methods

- addResolvables
- findNode
- getDependencies
- getPolicy
- getResolvable
- getTokens
- injector
- resolvePath
- subContext

## Constructors

- new ResolveContext(_path: PathNode[]): ResolveContext

- #### Parameters

  - ##### _path PathNode[]

  #### Returns ResolveContext

  - Defined in resolve/resolveContext.ts:35

## Properties

_injector: UIInjector

- Defined in resolve/resolveContext.ts:35

_path: PathNode[]

- Defined in resolve/resolveContext.ts:37

## Methods

- addResolvables(newResolvables: Resolvable[], state: StateObject): void

- Adds Resolvables to the node that matches the state

- Adds Resolvables to the node that matches the state

  This adds a Resolvable (generally one created on the fly; not declared on a StateDeclaration.resolve block). The resolvable is added to the node matching the `state` parameter.

  These new resolvables are not automatically fetched. The calling code should either fetch them, fetch something that depends on them, or rely on resolvePath being called when some state is being entered.

  Note: each resolvable's ResolvePolicy is merged with the state's policy, and the global default.

  #### Parameters

  - ##### newResolvables Resolvable[]

    :

    the new Resolvables

  - ##### state StateObject

    :

    Used to find the node to put the resolvable on

  #### Returns void

  - Defined in resolve/resolveContext.ts:105

- findNode(resolvable: Resolvable): PathNode

- #### Parameters

  - ##### resolvable Resolvable

  #### Returns PathNode

  - Defined in resolve/resolveContext.ts:156

- getDependencies(resolvable: Resolvable): Resolvable[]

- Gets the async dependencies of a Resolvable

- Gets the async dependencies of a Resolvable

  Given a Resolvable, returns its dependencies as a Resolvable[]

  #### Parameters

  - ##### resolvable Resolvable

  #### Returns Resolvable[]

  - Defined in resolve/resolveContext.ts:165

- getPolicy(resolvable: Resolvable): ResolvePolicy

- Returns the ResolvePolicy for the given Resolvable

- Returns the ResolvePolicy for the given Resolvable

  #### Parameters

  - ##### resolvable Resolvable

  #### Returns ResolvePolicy

  - Defined in resolve/resolveContext.ts:58

- getResolvable(token: any): Resolvable

- Gets the Resolvable that matches the token

- Gets the Resolvable that matches the token

  Gets the last Resolvable that matches the token in this context, or undefined. Throws an error if it doesn't exist in the ResolveContext

  #### Parameters

  - ##### token any

  #### Returns Resolvable

  - Defined in resolve/resolveContext.ts:50

- getTokens(): any[]

- Gets all the tokens found in the resolve context, de-duplicated

- Gets all the tokens found in the resolve context, de-duplicated

  #### Returns any[]

  - Defined in resolve/resolveContext.ts:40

- injector(): UIInjector

- #### Returns UIInjector

  - Defined in resolve/resolveContext.ts:152

- resolvePath(when?: PolicyWhen, trans?: Transition): Promise<object[]>

- Returns a promise for an array of resolved path Element promises

- Returns a promise for an array of resolved path Element promises

  #### Parameters

  - ##### when: Default value PolicyWhen = "LAZY"

    :

  - ##### trans: Optional Transition

    :

  #### Returns Promise<object[]>

  :

  - Defined in resolve/resolveContext.ts:118

- subContext(state: StateObject): ResolveContext

- Returns a ResolveContext that includes a portion of this one

- Returns a ResolveContext that includes a portion of this one

  Given a state, this method creates a new ResolveContext from this one. The new context starts at the first node (root) and stops at the node for the `state` parameter.

  #### Why

  When a transition is created, the nodes in the "To Path" are injected from a ResolveContext. A ResolveContext closes over a path of PathNodes and processes the resolvables. The "To State" can inject values from its own resolvables, as well as those from all its ancestor state's (node's). This method is used to create a narrower context when injecting ancestor nodes.

  example

    `let ABCD = new ResolveContext([A, B, C, D]);`

    Given a path `[A, B, C, D]`, where `A`, `B`, `C` and `D` are nodes for states `a`, `b`, `c`, `d`: When injecting `D`, `D` should have access to all resolvables from `A`, `B`, `C`, `D`. However, `B` should only be able to access resolvables from `A`, `B`.

    When resolving for the `B` node, first take the full "To Path" Context `[A,B,C,D]` and limit to the subpath `[A,B]`. `let AB = ABCD.subcontext(a)`

  #### Parameters

  - ##### state StateObject

  #### Returns ResolveContext

  - Defined in resolve/resolveContext.ts:86

Generated using TypeDoc