The UI-Router providers, for use in your application bootstrap
This is a StateBuilder.builder function for ngModule lazy loading in angular2.
This is a StateBuilder.builder function for ngModule lazy loading in angular2.
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)
.
A state that has a ngModule
var decl = {
ngModule: () => System.import('./childModule.ts')
}
would build a state with a lazyLoad
function like:
import { loadNgModule } from "ui-router-ng2";
var decl = {
lazyLoad: loadNgModule(() => System.import('./childModule.ts')
}
If the state has both a ngModule:
and a lazyLoad
, then the lazyLoad
is run first.
var decl = {
lazyLoad: () => System.import('third-party-library'),
ngModule: () => System.import('./childModule.ts')
}
would build a state with a lazyLoad
function like:
import { loadNgModule } from "ui-router-ng2";
var decl = {
lazyLoad: () => System.import('third-party-library')
.then(() => loadNgModule(() => System.import('./childModule.ts'))
}
This is a StateBuilder.builder function for angular2 views
.
This is a StateBuilder.builder function for angular2 views
.
When the StateBuilder builds a State object from a raw StateDeclaration, this builder
handles the views
property with logic specific to ui-router-ng2.
If no views: {}
property exists on the StateDeclaration, then it creates the views
object and
applies the state-level configuration to a view named $default
.
This is a factory function for a UIRouter instance
This is a factory function for a UIRouter instance
Creates a UIRouter instance and configures it for Angular 2, then invokes router bootstrap.
This function is used as an Angular 2 useFactory
Provider.
Generated using TypeDoc
UI-Router for Angular 2
Getting started:
ui-router-ng2
"ui-router-ng2"
import {StateRegistry} from "ui-router-ng2";
export let state1: Ng2StateDeclaration = { name: 'state1', component: State1Component, url: '/one' } export let state2: Ng2StateDeclaration = { name: 'state2', component: State2Component, url: '/two' }
NgModule
s.@ NgModule({ imports: [ SharedModule, UIRouterModule.forChild({ states: [state1, state2 ] }) ], declarations: [ State1Component, State2Component, ] }) export class MyFeatureModule {}
NgModule
<ui-view></ui-view>
viewport to your root component.@ NgModule({ imports: [ BrowserModule, UIRouterModule.forRoot({ states: [ homeState ] }), MyFeatureModule, ], declarations: [ HomeComponent ] bootstrap: [ UIView ] }) class RootAppModule {} browserPlatformDynamic.bootstrapModule(RootAppModule);
import {UIRouter} from "ui-router-ng2"; @ Injectable() export class MyUIRouterConfig { // Constructor is injectable constructor(uiRouter: UIRouter) { uiRouter.urlMatcherFactory.type('datetime', myDateTimeParamType); } }