The UI-Router providers, for use in your application bootstrap
Declares a NgModule with UI-Router states
Declares a NgModule with UI-Router states
A Typescript decorator for declaring an NgModule which contains UI-Router states and/or uses UI-Router directives and providers.
The decorator adds the UIRouterLibraryModule
NgModule as an import.
The `UIRouterLibraryModule has the UI-Router directives and providers.
The decorator also analyzes the states:
property.
When it finds a state with a routed component:
, it adds the component
to the module's declarations
and entryComponents
.
Note: adding the component to entryComponents
instructs the Module Compiler that those
components should be compiled.
Otherwise, they would not be automatically discovered as "reachable" by the compiler.
Further, the states found in the states:
property are added to Dependency Injection
using a specific token.
This will automatically register them with the StateRegistry when the application bootstraps.
(See also [NgModuleMetadataType](https://angular.io/docs/ts/latest/api/core/index/NgModuleMetadataType-interface.html)
Returns a function which lazy loads a nested module
Returns a function which lazy loads a nested module
Use this function as a StateDeclaration.lazyLoad property to lazy load a state tree (an NgModule).
the path to the module source code.
A function which takes a transition, then:
returns the new states array
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 StateBuilder.builder function which enables lazy Ng2Module support.
This is a StateBuilder.builder function which enables lazy Ng2Module support.
See loadNgModule
After lazy loading an NgModule, any Components from that module should be created using the NgModule's Injecjtor. The NgModule's ComponentFactory only exists inside that Injector.
After lazy loading an NgModule, it is stored on the root state of the lazy loaded state tree. When instantiating Component, the parent Component's Injector is merged with the NgModule injector.
Provides an Instance of UI-Router for NG2.
Provides an Instance of UI-Router for NG2.
Use this on the root NgModule to configure and create an instance of the Angular 2 UIRouter.
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
For the quick start repository, please see http://github.com/ui-router/quickstart-ng2
Getting started:
ui-router-ng2
"ui-router-ng2"
import {StateRegistry} from "ui-router-ng2";
directives:
array.<ui-view></ui-view>
viewport to your root component.import {UIRouter} from "ui-router-ng2"; import {INITIAL_STATES} from "./app.states"; @ Injectable() export class MyUIRouterConfig { configure(uiRouter: UIRouter) { INITIAL_STATES.forEach(function(state) { uiRouter.stateRegistry.register(state)); }); } }
import {provide} from "@angular/core"; import {bootstrap} from 'angular2/platform/browser'; import {UIRouterConfig, UIView, UIROUTER_PROVIDERS} from "ui-router-ng2"; import {MyUIRouterConfig} from "./router.config"; bootstrap(UIView, [ ...UIROUTER_PROVIDERS, provide(UIRouterConfig, { useClass: MyUIRouterConfig }) ]);