1
1
import { HTTP_INTERCEPTORS , HttpClient , HttpClientModule } from '@angular/common/http' ;
2
- import { CUSTOM_ELEMENTS_SCHEMA , Injector , NgModule } from '@angular/core' ;
2
+ import { APP_INITIALIZER , CUSTOM_ELEMENTS_SCHEMA , Injector , NgModule } from '@angular/core' ;
3
3
import { FormsModule , ReactiveFormsModule } from '@angular/forms' ;
4
4
import { BrowserModule } from '@angular/platform-browser' ;
5
5
import { BrowserAnimationsModule } from '@angular/platform-browser/animations' ;
@@ -36,6 +36,10 @@ import {TimezoneFormatService} from './shared/services/utm-timezone.service';
36
36
import { UtmSharedModule } from './shared/utm-shared.module' ;
37
37
import { AccountService } from "./core/auth/account.service" ;
38
38
39
+ export function initTimezoneFormat ( timezoneService : TimezoneFormatService ) {
40
+ return ( ) => timezoneService . loadTimezoneAndFormat ( ) ;
41
+ }
42
+
39
43
@NgModule ( {
40
44
declarations : [
41
45
AppComponent ,
@@ -105,11 +109,16 @@ import {AccountService} from "./core/auth/account.service";
105
109
useClass : ManageHttpInterceptor ,
106
110
multi : true ,
107
111
} ,
112
+ {
113
+ provide : APP_INITIALIZER ,
114
+ useFactory : initTimezoneFormat ,
115
+ deps : [ TimezoneFormatService ] ,
116
+ multi : true
117
+ } ,
108
118
NewAlertBehavior ,
109
119
NavBehavior ,
110
120
AlertIncidentStatusChangeBehavior ,
111
- GettingStartedBehavior ,
112
- TimezoneFormatService
121
+ GettingStartedBehavior
113
122
] ,
114
123
bootstrap : [ AppComponent ] ,
115
124
schemas : [ CUSTOM_ELEMENTS_SCHEMA ] ,
@@ -118,6 +127,5 @@ export class AppModule {
118
127
constructor ( private dpConfig : NgbDatepickerConfig , private config : NgbModalConfig ) {
119
128
this . dpConfig . minDate = { year : moment ( ) . year ( ) - 100 , month : 1 , day : 1 } ;
120
129
config . backdrop = 'static' ;
121
- //timezoneFormatService.loadTimezoneAndFormat();
122
130
}
123
131
}
0 commit comments