@uirouter/core/state/stateBuilder | @uirouter/react
Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @uirouter/core/state/stateBuilder

Index

Classes

Type aliases

Functions

Type aliases

BuilderFunction

BuilderFunction: (state: StateObject, parent?: BuilderFunction) => any

A function that builds the final value for a specific field on a StateObject.

A series of builder functions for a given field are chained together. The final value returned from the chain of builders is applied to the built StateObject. Builder functions should call the [[parent]] function either first or last depending on the desired composition behavior.

param

the partially built StateObject. The StateDeclaration can be inspected via StateObject.self

param

the previous builder function in the series.

Type declaration

Functions

resolvablesBuilder

  • This is a StateBuilder.builder function for the resolve: block on a StateDeclaration.

    When the StateBuilder builds a StateObject object from a raw StateDeclaration, this builder validates the resolve property and converts it to a Resolvable array.

    resolve: input value can be:

    { // analyzed but not injected myFooResolve: function() { return "myFooData"; },

    // function.toString() parsed, "DependencyName" dep as string (not min-safe) myBarResolve: function(DependencyName) { return DependencyName.fetchSomethingAsPromise() },

    // Array split; "DependencyName" dep as string myBazResolve: [ "DependencyName", function(dep) { return dep.fetchSomethingAsPromise() },

    // Array split; DependencyType dep as token (compared using ===) myQuxResolve: [ DependencyType, function(dep) { return dep.fetchSometingAsPromise() },

    // val.$inject used as deps // where: // corgeResolve.$inject = ["DependencyName"]; // function corgeResolve(dep) { dep.fetchSometingAsPromise() } // then "DependencyName" dep as string myCorgeResolve: corgeResolve,

    // inject service by name // When a string is found, desugar creating a resolve that injects the named service myGraultResolve: "SomeService" }

    or:

    [ new Resolvable("myFooResolve", function() { return "myFooData" }), new Resolvable("myBarResolve", function(dep) { return dep.fetchSomethingAsPromise() }, [ "DependencyName" ]), { provide: "myBazResolve", useFactory: function(dep) { dep.fetchSomethingAsPromise() }, deps: [ "DependencyName" ] } ]

    Parameters

    Returns Resolvable[]

Generated using TypeDoc