|
1 | 1 | import {NgModule, Optional, SkipSelf} from '@angular/core'; |
2 | | -import {ReactiveFormsModule} from '@angular/forms'; |
3 | | -import {RouterModule} from '@angular/router'; |
4 | 2 | import {ProgressBarService} from './services/progress-bar.service'; |
5 | | -import {LoggerService} from './services/logger.service'; |
6 | | -import {HeroService} from '../modules/heroes/shared/hero.service'; |
7 | 3 | import {TimingInterceptor} from './interceptors/timing.interceptor'; |
8 | | -import {HTTP_INTERCEPTORS} from '@angular/common/http'; |
| 4 | +import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http'; |
9 | 5 | import {ProgressInterceptor} from './interceptors/progress.interceptor'; |
10 | | - |
11 | | -function throwIfAlreadyLoaded(parentModule: any, moduleName: string) { |
12 | | - if (parentModule) { |
13 | | - throw new Error(`${moduleName} has already been loaded. Import Core modules in the AppModule only.`); |
14 | | - } |
15 | | -} |
| 6 | +import {BrowserModule} from '@angular/platform-browser'; |
| 7 | +import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; |
| 8 | +import {TranslateModule} from '@ngx-translate/core'; |
| 9 | +import {RouterModule} from '@angular/router'; |
16 | 10 |
|
17 | 11 | @NgModule({ |
18 | 12 | imports: [ |
19 | | - /*ReactiveFormsModule, |
20 | | - RouterModule*/ |
| 13 | + BrowserModule, |
| 14 | + BrowserAnimationsModule, |
| 15 | + TranslateModule.forChild(), |
| 16 | + RouterModule, |
| 17 | + HttpClientModule |
| 18 | + ], |
| 19 | + exports: [ |
| 20 | + BrowserModule, |
| 21 | + BrowserAnimationsModule, |
| 22 | + HttpClientModule |
21 | 23 | ], |
22 | 24 | providers: [ |
23 | 25 | {provide: HTTP_INTERCEPTORS, useClass: ProgressInterceptor, multi: true, deps: [ProgressBarService]}, |
24 | | - {provide: HTTP_INTERCEPTORS, useClass: TimingInterceptor, multi: true}, |
25 | | - HeroService, |
26 | | - LoggerService, |
27 | | - ProgressBarService |
| 26 | + {provide: HTTP_INTERCEPTORS, useClass: TimingInterceptor, multi: true} |
28 | 27 | ] |
29 | 28 | }) |
30 | 29 |
|
31 | 30 | export class CoreModule { |
32 | 31 | constructor(@Optional() @SkipSelf() parentModule: CoreModule) { |
33 | | - throwIfAlreadyLoaded(parentModule, 'CoreModule'); |
| 32 | + if (parentModule) { |
| 33 | + throw new Error(`CoreModule has already been loaded. Import Core modules in the AppModule only.`); |
| 34 | + } |
34 | 35 | } |
35 | 36 | } |
0 commit comments