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).
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 callsloadNgModule(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 alazyLoad
, then thelazyLoad
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')) }