ec06a91b801aa6a3ab9a69e7a05072356d54bd07
[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, DatePipe, CurrencyPipe} 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
10 /*
11 Note core services are injected into 'root'.
12 They do not have to be added to the providers list.
13 */
14
15 // consider moving these to core...
16 import {FormatService, FormatValuePipe} from '@eg/core/format.service';
17 import {PrintService} from '@eg/share/print/print.service';
18
19 // Globally available components
20 import {PrintComponent} from '@eg/share/print/print.component';
21 import {DialogComponent} from '@eg/share/dialog/dialog.component';
22 import {AlertDialogComponent} from '@eg/share/dialog/alert.component';
23 import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component';
24 import {PromptDialogComponent} from '@eg/share/dialog/prompt.component';
25 import {ProgressInlineComponent} from '@eg/share/dialog/progress-inline.component';
26 import {ProgressDialogComponent} from '@eg/share/dialog/progress.component';
27
28 @NgModule({
29   declarations: [
30     PrintComponent,
31     DialogComponent,
32     AlertDialogComponent,
33     ConfirmDialogComponent,
34     PromptDialogComponent,
35     ProgressInlineComponent,
36     ProgressDialogComponent,
37     FormatValuePipe
38   ],
39   imports: [
40     CommonModule,
41     FormsModule,
42     RouterModule,
43     NgbModule
44   ],
45   exports: [
46     CommonModule,
47     RouterModule,
48     NgbModule,
49     FormsModule,
50     PrintComponent,
51     DialogComponent,
52     AlertDialogComponent,
53     ConfirmDialogComponent,
54     PromptDialogComponent,
55     ProgressInlineComponent,
56     ProgressDialogComponent,
57     FormatValuePipe
58   ]
59 })
60
61 export class EgCommonModule {
62     /** forRoot() lets us define services that should only be
63      * instantiated once for all loaded routes */
64     static forRoot(): ModuleWithProviders {
65         return {
66             ngModule: EgCommonModule,
67             providers: [
68                 DatePipe,
69                 CurrencyPipe,
70                 PrintService,
71                 FormatService
72             ]
73         };
74     }
75 }
76