2018-06-25 17:03:52 +02:00
|
|
|
// angular modules
|
2018-07-23 16:42:17 +02:00
|
|
|
import { BrowserModule } from '@angular/platform-browser';
|
2018-06-25 17:03:52 +02:00
|
|
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
2018-09-20 13:03:51 +02:00
|
|
|
import { NgModule, APP_INITIALIZER } from '@angular/core';
|
2018-11-08 15:34:43 +01:00
|
|
|
import { HttpClientModule, HttpClientXsrfModule } from '@angular/common/http';
|
2018-12-04 19:31:24 +01:00
|
|
|
import { PapaParseModule } from 'ngx-papaparse';
|
2018-06-25 17:03:52 +02:00
|
|
|
|
2018-07-23 16:42:17 +02:00
|
|
|
// Elementary App Components
|
2018-06-16 18:05:46 +02:00
|
|
|
import { AppRoutingModule } from './app-routing.module';
|
2018-07-23 16:42:17 +02:00
|
|
|
import { AppComponent } from './app.component';
|
|
|
|
import { CoreModule } from './core/core.module';
|
2018-07-12 14:11:31 +02:00
|
|
|
|
|
|
|
// translation module.
|
2018-07-23 16:42:17 +02:00
|
|
|
import { LoginModule } from './site/login/login.module';
|
2018-09-20 13:03:51 +02:00
|
|
|
import { AppLoadService } from './core/services/app-load.service';
|
2019-01-10 15:06:10 +01:00
|
|
|
import { ProjectorModule } from './site/projector/projector.module';
|
|
|
|
import { SlidesModule } from './slides/slides.module';
|
2018-11-08 15:34:43 +01:00
|
|
|
import { OpenSlidesTranslateModule } from './core/translate/openslides-translate-module';
|
2018-06-29 17:24:44 +02:00
|
|
|
|
2019-01-16 14:04:15 +01:00
|
|
|
// PWA
|
|
|
|
import { ServiceWorkerModule } from '@angular/service-worker';
|
|
|
|
import { environment } from '../environments/environment';
|
|
|
|
|
2018-09-20 13:03:51 +02:00
|
|
|
/**
|
|
|
|
* Returns a function that returns a promis that will be resolved, if all apps are loaded.
|
|
|
|
* @param appLoadService The service that loads the apps.
|
|
|
|
*/
|
|
|
|
export function AppLoaderFactory(appLoadService: AppLoadService): () => Promise<void> {
|
|
|
|
return () => appLoadService.loadApps();
|
|
|
|
}
|
|
|
|
|
2018-07-23 16:42:17 +02:00
|
|
|
/**
|
|
|
|
* Global App Module. Keep it as clean as possible.
|
|
|
|
*/
|
2018-06-13 18:34:10 +02:00
|
|
|
@NgModule({
|
2018-07-23 16:42:17 +02:00
|
|
|
declarations: [AppComponent],
|
2018-06-19 16:55:50 +02:00
|
|
|
imports: [
|
|
|
|
BrowserModule,
|
|
|
|
HttpClientModule,
|
|
|
|
HttpClientXsrfModule.withOptions({
|
|
|
|
cookieName: 'OpenSlidesCsrfToken',
|
|
|
|
headerName: 'X-CSRFToken'
|
|
|
|
}),
|
2018-07-31 15:46:55 +02:00
|
|
|
BrowserAnimationsModule,
|
2018-11-08 15:34:43 +01:00
|
|
|
OpenSlidesTranslateModule.forRoot(),
|
2018-07-23 16:42:17 +02:00
|
|
|
AppRoutingModule,
|
|
|
|
CoreModule,
|
2018-12-04 19:31:24 +01:00
|
|
|
LoginModule,
|
2019-01-16 14:04:15 +01:00
|
|
|
PapaParseModule,
|
2019-01-10 15:06:10 +01:00
|
|
|
ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }),
|
|
|
|
ProjectorModule,
|
|
|
|
SlidesModule.forRoot()
|
2018-07-12 14:11:31 +02:00
|
|
|
],
|
2018-09-20 13:03:51 +02:00
|
|
|
providers: [{ provide: APP_INITIALIZER, useFactory: AppLoaderFactory, deps: [AppLoadService], multi: true }],
|
2018-06-19 16:55:50 +02:00
|
|
|
bootstrap: [AppComponent]
|
2018-06-13 18:34:10 +02:00
|
|
|
})
|
2018-06-19 16:55:50 +02:00
|
|
|
export class AppModule {}
|