2018-07-23 16:42:17 +02:00
|
|
|
import { NgModule, Optional, SkipSelf } from '@angular/core';
|
|
|
|
import { CommonModule } from '@angular/common';
|
|
|
|
import { Title } from '@angular/platform-browser';
|
|
|
|
import { HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
|
|
|
|
|
|
// Core Services, Directives
|
|
|
|
import { AuthGuard } from './services/auth-guard.service';
|
|
|
|
import { AuthService } from './services/auth.service';
|
|
|
|
import { AutoupdateService } from './services/autoupdate.service';
|
2018-08-22 16:03:49 +02:00
|
|
|
import { DataStoreService } from './services/data-store.service';
|
2018-07-23 16:42:17 +02:00
|
|
|
import { OperatorService } from './services/operator.service';
|
|
|
|
import { WebsocketService } from './services/websocket.service';
|
|
|
|
import { AddHeaderInterceptor } from './http-interceptor';
|
2018-08-22 16:03:49 +02:00
|
|
|
import { DataSendService } from './services/data-send.service';
|
2018-08-23 16:49:51 +02:00
|
|
|
import { ViewportService } from './services/viewport.service';
|
2018-07-23 16:42:17 +02:00
|
|
|
|
|
|
|
/** Global Core Module. Contains all global (singleton) services
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
@NgModule({
|
|
|
|
imports: [CommonModule],
|
|
|
|
providers: [
|
|
|
|
Title,
|
|
|
|
AuthGuard,
|
|
|
|
AuthService,
|
|
|
|
AutoupdateService,
|
|
|
|
DataStoreService,
|
2018-08-22 16:03:49 +02:00
|
|
|
DataSendService,
|
2018-07-23 16:42:17 +02:00
|
|
|
OperatorService,
|
2018-08-23 16:49:51 +02:00
|
|
|
ViewportService,
|
2018-07-23 16:42:17 +02:00
|
|
|
WebsocketService,
|
|
|
|
{
|
|
|
|
provide: HTTP_INTERCEPTORS,
|
|
|
|
useClass: AddHeaderInterceptor,
|
|
|
|
multi: true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
export class CoreModule {
|
|
|
|
/** make sure CoreModule is imported only by one NgModule, the AppModule */
|
2018-08-29 13:21:25 +02:00
|
|
|
public constructor(
|
2018-07-23 16:42:17 +02:00
|
|
|
@Optional()
|
|
|
|
@SkipSelf()
|
|
|
|
parentModule: CoreModule
|
|
|
|
) {
|
|
|
|
if (parentModule) {
|
|
|
|
throw new Error('CoreModule is already loaded. Import only in AppModule');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|