Determines the unwrapping behavior of asynchronous resolve values.
WAIT
(default)
NOWAIT
NOTE: The previous RXWAIT
policy has become a CustomAsyncPolicy function exported in @uirouter/rx
package.
The Transition
will not wait for the resolve promise(s) from main
to settle before continuing.
Resolves for main
will be provided to components wrapped in a Promise
.
The Transition
will wait for the main.home
resolve promises.
Resolved values will be unwrapped before being provided to components.
var mainState = {
name: 'main',
resolve: mainResolves, // defined elsewhere
resolvePolicy: { async: 'NOWAIT' },
}
var homeState = {
name: 'main.home',
resolve: homeResolves, // defined elsewhere
resolvePolicy: { async: 'WAIT' }, // default
}
Defines when a Resolvable is resolved (fetched) during a transition
LAZY
(default)EAGER
Resolves for main
and main.home
are fetched when each state is entered.
All of main
resolves are processed before fetching main.home
resolves.
var state = {
name: 'main',
resolve: mainResolves, // defined elsewhere
resolvePolicy: { when: 'LAZY' }, // default
}
var state = {
name: 'main.home',
resolve: homeResolves, // defined elsewhere
resolvePolicy: { when: 'LAZY' }, // default
}
Resolves for main
and main.home
are fetched at the same time when the transition starts.
This happens earlier in the lifecycle than when states are entered.
All of the main
and main.home
resolves are fetched as soon as possible.
var mainState = {
name: 'main',
resolve: mainResolves, // defined elsewhere
resolvePolicy: { when: 'EAGER' },
}
var homeState = {
name: 'main.home',
resolve: homeResolves, // defined elsewhere
resolvePolicy: { when: 'EAGER' },
}
Generated using TypeDoc
Defines how a resolve is processed during a transition
This object is the StateDeclaration.resolvePolicy property.
Example:
// Fetched when the resolve's state is being entered. // Wait for the promise to resolve. var policy1 = { when: "LAZY", async: "WAIT" } // Fetched when the Transition is starting. // Do not wait for the returned promise to resolve. // Inject the raw promise/value var policy2 = { when: "EAGER", async: "NOWAIT" }
The policy for a given Resolvable is merged from three sources (highest priority first):
Example:
// Wait for an Observable to emit one item. // Since `wait` is not specified, it uses the `wait` // policy defined on the state, or the global default // if no `wait` policy is defined on the state import { RXWAIT } from '@uirouter/rx'; var myResolvablePolicy = { async: RXWAIT }