Resolvable | @uirouter/angularjs
Options
Menu

The basic building block for the resolve system.

Resolvables encapsulate a state's resolve's resolveFn, the resolveFn's declared dependencies, the wrapped (.promise), and the unwrapped-when-complete (.data) result of the resolveFn.

Resolvable.get() either retrieves the Resolvable's existing promise, or else invokes resolve() (which invokes the resolveFn) and returns the resulting promise.

Resolvable.get() and Resolvable.resolve() both execute within a context path, which is passed as the first parameter to those fns.

Hierarchy

  • Resolvable

Implements

Index

Constructors

  • This constructor creates a Resolvable copy

    Example:

    var resolvable1 = new Resolvable('mytoken', http => http.get('foo.json').toPromise(), [Http]);
    
    var resolvable2 = new Resolvable(UserService, dep => new UserService(dep.data), [SomeDependency]);
    
    var resolvable1Clone = new Resolvable(resolvable1);
    

    Parameters

    Returns Resolvable


  • This constructor creates a new Resolvable from the plain old ResolvableLiteral javascript object

    Example:

    var resolvable1 = new Resolvable('mytoken', http => http.get('foo.json').toPromise(), [Http]);
    
    var resolvable2 = new Resolvable(UserService, dep => new UserService(dep.data), [SomeDependency]);
    
    var resolvable1Clone = new Resolvable(resolvable1);
    

    Parameters

    Returns Resolvable


  • This constructor creates a new Resolvable

    Example:

    var resolvable1 = new Resolvable('mytoken', http => http.get('foo.json').toPromise(), [Http]);
    
    var resolvable2 = new Resolvable(UserService, dep => new UserService(dep.data), [SomeDependency]);
    
    var resolvable1Clone = new Resolvable(resolvable1);
    

    Parameters

    • token any
      :

      The new resolvable's injection token, such as "userList" (a string) or UserService (a class). When this token is used during injection, the resolved value will be injected.

    • resolveFn Function
      :

      The function that returns the resolved value, or a promise for the resolved value

    • deps: Optional  any[]
      :

      An array of dependencies, which will be injected into the resolveFn

    • policy: Optional  ResolvePolicy
      :

      the ResolvePolicy defines when and how the Resolvable is processed

    • data: Optional  any
      :

      Pre-resolved data. If the resolve value is already known, it may be provided here.

    Returns Resolvable


Properties

data: any
deps: any[]
promise: Promise<any> = undefined
resolveFn: Function
resolved: boolean = false
token: any

Methods

  • Returns Resolvable


  • Gets a promise for this Resolvable's data.

    Fetches the data and returns a promise. Returns the existing promise if it has already been fetched once.

    Parameters

    Returns Promise<any>


  • Parameters

    Returns ResolvePolicy


  • resolve(resolveContext: ResolveContext, trans?: Transition): Promise<any>
  • Asynchronously resolve this Resolvable's data

  • Asynchronously resolve this Resolvable's data

    Given a ResolveContext that this Resolvable is found in: Wait for this Resolvable's dependencies, then invoke this Resolvable's function and update the Resolvable's state

    Parameters

    Returns Promise<any>


  • toString(): string
  • Returns string


  • Parameters

    • token any
    • data any

    Returns Resolvable


Generated using TypeDoc