ResolveContext class encapsulates dependency injection for a path of state nodes. It provides DI for the last node in the path and manages resolvable resolution.
Overview
PathNode. The ResolveContext closes over these PathNode objects and provides dependency injection.
Constructor
_path- Array ofPathNodeobjects representing the state path
Methods
getTokens()
Gets all tokens found in the resolve context.getResolvable()
Gets the Resolvable that matches the token.token- The resolvable token to find
getPolicy()
Returns the resolve policy for the given Resolvable.resolvable- The Resolvable to get the policy for
subContext()
Returns a ResolveContext that includes a portion of this one.state- The state to create a subcontext up to
B, it should only have access to resolvables from A and B, not from child states C and D.
Example:
addResolvables()
Adds Resolvables to the node matching the state.newResolvables- Array of new Resolvables to addstate- Used to find the node to add resolvables to
resolvePath()
Returns a promise for an array of resolved path elements.when- Which resolvables to fetch ('LAZY'or'EAGER'; defaults to'LAZY')trans- The transition (optional)
{ token, value } objects.
'EAGER'- Fetch only EAGER resolvables'LAZY'- Fetch both EAGER and LAZY resolvables
injector()
Gets the UIInjector for this context.UIInjector that can inject values from this resolve context.
Example:
findNode()
Finds the PathNode containing a specific Resolvable.resolvable- The Resolvable to find
getDependencies()
Gets the async dependencies of a Resolvable.resolvable- The Resolvable to get dependencies for
UIInjector Interface
The injector returned byinjector() implements:
get()
Gets a synchronous value from the injector.token- The token to inject
getAsync()
Gets an asynchronous value from the injector.token- The token to inject
getNative()
Gets a value from the native injector.token- The token to inject