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

Interface RootModule

UI-Router declarative configuration which can be provided to UIRouterModule.forRoot

Hierarchy

Index

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 {} ```

deferIntercept: boolean
otherwise: string | Function | object
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.

useHash: boolean

Chooses a LocationStrategy.

Chooses a LocationStrategy.

The location strategy enables either HTML5 Push State (Requires server-side support) or "HashBang" URLs.

When false, uses PathLocationStrategy When true, uses HashLocationStrategy

Defaults to false

Generated using TypeDoc