StatesModule | UI-Router
Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface StatesModule

UI-Router Module declarative configuration which can be passed to UIRouterModule.forChild

Hierarchy

  • StatesModule

Index

Properties

Properties

configClass: Type<any>

A UI-Router Module's imperative configuration

A UI-Router Module's imperative configuration

If a UI-Router Module needs to perform some configuration (such as registering parameter types or Transition Hooks) a configClass should be supplied.

Mark the class as @Injectable() and inject any required dependencies. When the module is being loaded, an instance will be created and injected.

Example: ```js

injectable

() export class MyUIRouterConfig { // The constructor may be injected constructor(uiRouter: UIRouter) { const requireAuthentication = (transition: Transition) => { let injector = transition.injector(); if (!injector.get(AuthService).isAuthenticated()) { return uiRouter.stateService.target('login'); } }

uiRouter.transitionService.onBefore({ to: (state) => state.requiresAuth }, requireAuthentication);

let builtInStringType = urlMatcherFactory.type('string');
let slugType = Object.assign({}, builtInStringType, { encode: (str) => str, decode: (str) => str });
uiRouter.urlMatcherFactory.type('slug', slugType);

} } ```

```js

ngmodule

({ imports: [ UIRouterModule.forChild({ states: STATES, configClass: MyUIRouterConfig }); ] }) class MyModule {} ```

states: Ng2StateDeclaration[]

The module's UI-Router states

The module's UI-Router states

This list of Ng2StateDeclaration objects will be registered with the StateRegistry. Also, the components that the states route to will be added to entryComponents so they will be compiled.

Generated using TypeDoc