|
1 | 1 | import {Ng2StateDeclaration} from "./interface";
|
2 | 2 | import {NgModule, NgModuleMetadataType, OpaqueToken} from "@angular/core";
|
3 |
| -import {UIROUTER_DIRECTIVES} from "./directives/directives"; |
4 |
| -import {UIROUTER_PROVIDERS} from "./providers"; |
| 3 | +import {_UIROUTER_DIRECTIVES} from "./directives/directives"; |
| 4 | +import {_UIROUTER_PROVIDERS} from "./providers"; |
5 | 5 | import {UIView} from "./directives/uiView";
|
6 | 6 | import {uniqR, flattenR} from "../common/common";
|
7 | 7 |
|
8 | 8 | @NgModule({
|
9 |
| - declarations: [UIROUTER_DIRECTIVES], |
10 |
| - exports: [UIROUTER_DIRECTIVES], |
| 9 | + declarations: [_UIROUTER_DIRECTIVES], |
| 10 | + exports: [_UIROUTER_DIRECTIVES], |
11 | 11 | entryComponents: [UIView],
|
12 |
| - providers: [UIROUTER_PROVIDERS] |
| 12 | + providers: [_UIROUTER_PROVIDERS] |
13 | 13 | })
|
14 | 14 | export class UIRouterRootModule {}
|
15 | 15 |
|
@@ -39,12 +39,31 @@ export const UIROUTER_STATES_TOKEN = new OpaqueToken("UIRouter States");
|
39 | 39 | *
|
40 | 40 | * var homeState = { name: 'home', url: '/home', component: Home };
|
41 | 41 | * var aboutState = { name: 'about', url: '/about', component: About };
|
| 42 | + * |
42 | 43 | * @UIRouterModule({
|
43 | 44 | * imports: [BrowserModule],
|
44 | 45 | * declarations: [NonRoutedComponent],
|
45 | 46 | * states: [homeState, aboutState]
|
46 | 47 | * }) export class AppModule {};
|
47 | 48 | * ```
|
| 49 | + * |
| 50 | + * The `UIRouterModule` decorator creates an Angular 2 `NgModule`. |
| 51 | + * The equivalent `AppModule` could also be crafted by hand using the `NgModule` decorator: |
| 52 | + * |
| 53 | + * ``` |
| 54 | + * var homeState = { name: 'home', url: '/home', component: Home }; |
| 55 | + * var aboutState = { name: 'about', url: '/about', component: About }; |
| 56 | + * |
| 57 | + * @NgModule({ |
| 58 | + * imports: [BrowserModule, UIRouterRootModule], |
| 59 | + * declarations: [NonRoutedComponent, Home, About], |
| 60 | + * entryComponents: [Home, About], |
| 61 | + * providers: [ |
| 62 | + * { provide: UIROUTER_STATES_TOKEN, useValue: [homeState, aboutState], multi: true } |
| 63 | + * ] |
| 64 | + * }) export class AppModule {}; |
| 65 | + * |
| 66 | + * ``` |
48 | 67 | *
|
49 | 68 | * @param moduleMetaData the [[UIRouterModuleMetadata]]
|
50 | 69 | * (See also [NgModuleMetadataType](https://angular.io/docs/ts/latest/api/core/index/NgModuleMetadataType-interface.html)
|
|
0 commit comments