ResolvePolicy | UI-Router
Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ResolvePolicy

Defines how a resolve is processed during a transition

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):

1) Individual resolve definition 2) State definition 3) Global default

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
var myResolvablePolicy = { async: "RXWAIT" }

Hierarchy

  • ResolvePolicy

Index

Properties

Properties

async: PolicyAsync

Determines the unwrapping behavior of asynchronous resolve values.

Determines the unwrapping behavior of asynchronous resolve values.

  • WAIT (default) if a promise is returned from the resolveFn, wait for the promise before proceeding
  • NOWAIT if a promise is returned from the resolve, do not wait for the promise.
         The promise will not be unwrapped.
         The promise itself will be provided when the resolve is injected or bound elsewhere.
    
  • RXWAIT When an Observable is returned from the resolveFn, wait until the Observable emits at least one item.
         The Observable item will not be unwrapped.
         The Observable stream itself will be provided when the resolve is injected or bound elsewhere.
    
when: PolicyWhen

Defines when a Resolvable is resolved (fetched) during a transition

Defines when a Resolvable is resolved (fetched) during a transition

  • LAZY (default) resolved as the resolve's state is being entered
  • EAGER resolved as the transition is starting

Generated using TypeDoc