LP1831788 Add EgCoreModule for CommonWidgetsModule, etc.
[working/Evergreen.git] / Open-ILS / src / eg2 / src / app / common.module.ts
1 /**
2  * Modules, services, and components used by all apps.
3  */
4 import {CommonModule} from '@angular/common';
5 import {NgModule, ModuleWithProviders} from '@angular/core';
6 import {RouterModule} from '@angular/router';
7 import {FormsModule} from '@angular/forms';
8 import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
9 import {EgCoreModule} from '@eg/core/core.module';
10
11 /*
12 Note core services are injected into 'root'.
13 They do not have to be added to the providers list.
14 */
15
16 // consider moving these to core...
17 import {HatchService} from '@eg/share/print/hatch.service';
18 import {PrintService} from '@eg/share/print/print.service';
19
20 // Globally available components
21 import {PrintComponent} from '@eg/share/print/print.component';
22 import {DialogComponent} from '@eg/share/dialog/dialog.component';
23 import {AlertDialogComponent} from '@eg/share/dialog/alert.component';
24 import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component';
25 import {PromptDialogComponent} from '@eg/share/dialog/prompt.component';
26 import {ProgressInlineComponent} from '@eg/share/dialog/progress-inline.component';
27 import {ProgressDialogComponent} from '@eg/share/dialog/progress.component';
28 import {BoolDisplayComponent} from '@eg/share/util/bool.component';
29
30 @NgModule({
31   declarations: [
32     PrintComponent,
33     DialogComponent,
34     AlertDialogComponent,
35     ConfirmDialogComponent,
36     PromptDialogComponent,
37     ProgressInlineComponent,
38     ProgressDialogComponent,
39     BoolDisplayComponent
40   ],
41   imports: [
42     CommonModule,
43     FormsModule,
44     RouterModule,
45     NgbModule,
46     EgCoreModule
47   ],
48   exports: [
49     CommonModule,
50     RouterModule,
51     NgbModule,
52     FormsModule,
53     EgCoreModule,
54     PrintComponent,
55     DialogComponent,
56     AlertDialogComponent,
57     ConfirmDialogComponent,
58     PromptDialogComponent,
59     ProgressInlineComponent,
60     ProgressDialogComponent,
61     BoolDisplayComponent,
62   ]
63 })
64
65 export class EgCommonModule {
66     /** forRoot() lets us define services that should only be
67      * instantiated once for all loaded routes */
68     static forRoot(): ModuleWithProviders {
69         return {
70             ngModule: EgCommonModule,
71             providers: [
72                 HatchService,
73                 PrintService
74             ]
75         };
76     }
77 }
78