"statebuilders/lazyLoad" | @uirouter/angular
Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "statebuilders/lazyLoad"

Index

Functions

Functions

ng2LazyLoadBuilder

  • This is a StateBuilder.builder function for ngModule lazy loading in Angular.

    When the StateBuilder builds a [[State]] object from a raw StateDeclaration, this builder decorates the lazyLoad property for states that have a [[Ng2StateDeclaration.ngModule]] declaration.

    If the state has a [[Ng2StateDeclaration.ngModule]], it will create a lazyLoad function that in turn calls loadNgModule(loadNgModuleFn).

    Example:

    A state that has a ngModule

    var decl = {
      ngModule: () => import('./childModule.ts')
    }

    would build a state with a lazyLoad function like:

    import { loadNgModule } from "@uirouter/angular";
    var decl = {
      lazyLoad: loadNgModule(() => import('./childModule.ts')
    }

    If the state has both a ngModule: and a lazyLoad, then the lazyLoad is run first.

    Example:

    var decl = {
      lazyLoad: () => import('third-party-library'),
      ngModule: () => import('./childModule.ts')
    }

    would build a state with a lazyLoad function like:

    import { loadNgModule } from "@uirouter/angular";
    var decl = {
      lazyLoad: () => import('third-party-library')
          .then(() => loadNgModule(() => import('./childModule.ts'))
    }

    Parameters

    Returns (transition: Transition, state: StateDeclaration) => Promise<LazyLoadResult>

Generated using TypeDoc