/
core.module.ts
73 lines (69 loc) · 2.38 KB
/
core.module.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { NgModule, LOCALE_ID } from '@angular/core';
import { DatePipe, registerLocaleData } from '@angular/common';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { Title } from '@angular/platform-browser';
import { FaIconLibrary } from '@fortawesome/angular-fontawesome';
import { fas } from '@fortawesome/free-solid-svg-icons';
import { CookieModule } from 'ngx-cookie';
import { NgxWebstorageModule } from 'ngx-webstorage';
import { NgJhipsterModule } from 'ng-jhipster';
import locale from '@angular/common/locales/en';
import * as moment from 'moment';
import { NgbDateAdapter, NgbDatepickerConfig } from '@ng-bootstrap/ng-bootstrap';
import { NgbDateMomentAdapter } from 'app/shared/util/datepicker-adapter';
import { AuthInterceptor } from 'app/blocks/interceptor/auth.interceptor';
import { AuthExpiredInterceptor } from 'app/blocks/interceptor/auth-expired.interceptor';
import { ErrorHandlerInterceptor } from 'app/blocks/interceptor/errorhandler.interceptor';
import { NotificationInterceptor } from 'app/blocks/interceptor/notification.interceptor';
import { fontAwesomeIcons } from './icons/font-awesome-icons';
import { GroupByPipe } from 'app/shared/pipe/group-by.pipe';
@NgModule({
imports: [
HttpClientModule,
CookieModule.forRoot(),
NgxWebstorageModule.forRoot({ prefix: 'jhi', separator: '-' }),
NgJhipsterModule.forRoot({
// set below to true to make alerts look like toast
alertAsToast: false,
alertTimeout: 5000
})
],
providers: [
Title,
{
provide: LOCALE_ID,
useValue: 'en'
},
{ provide: NgbDateAdapter, useClass: NgbDateMomentAdapter },
DatePipe,
{
provide: HTTP_INTERCEPTORS,
useClass: AuthInterceptor,
multi: true
},
{
provide: HTTP_INTERCEPTORS,
useClass: AuthExpiredInterceptor,
multi: true
},
{
provide: HTTP_INTERCEPTORS,
useClass: ErrorHandlerInterceptor,
multi: true
},
{
provide: HTTP_INTERCEPTORS,
useClass: NotificationInterceptor,
multi: true
},
GroupByPipe
]
})
export class JHipsterRegistryCoreModule {
constructor(iconLibrary: FaIconLibrary, dpConfig: NgbDatepickerConfig) {
registerLocaleData(locale);
iconLibrary.addIconPacks(fas);
iconLibrary.addIcons(...fontAwesomeIcons);
dpConfig.minDate = { year: moment().year() - 100, month: 1, day: 1 };
}
}