Projekt

Obecné

Profil

Stáhnout (1.74 KB) Statistiky
| Větev: | Tag: | Revize:
1 f8b9a3a2 hlavja
/* tslint:disable */
2
/* eslint-disable */
3
import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
4
import { HttpClient } from '@angular/common/http';
5
import { ApiConfiguration, ApiConfigurationParams } from './api-configuration';
6
7
import { LoginService } from './services/login.service';
8 b6006ff4 hlavja
import { AdministrationService } from './services/administration.service';
9 11efc186 hlavja
import { ObservationService } from './services/observation.service';
10 f8b9a3a2 hlavja
import { GroupService } from './services/group.service';
11 1d6ec56f hlavja
import { DataService } from './services/data.service';
12 a7285540 hlavja
import { AnalyticsService } from './services/analytics.service';
13 a3ae1cab hlavja
import { ManagementService } from './services/management.service';
14
import { SensorsService } from './services/sensors.service';
15 f8b9a3a2 hlavja
16
/**
17
 * Module that provides all services and configuration.
18
 */
19
@NgModule({
20
  imports: [],
21
  exports: [],
22
  declarations: [],
23
  providers: [
24
    LoginService,
25 b6006ff4 hlavja
    AdministrationService,
26 11efc186 hlavja
    ObservationService,
27 f8b9a3a2 hlavja
    GroupService,
28 1d6ec56f hlavja
    DataService,
29 a7285540 hlavja
    AnalyticsService,
30 a3ae1cab hlavja
    ManagementService,
31
    SensorsService,
32 f8b9a3a2 hlavja
    ApiConfiguration
33
  ],
34
})
35
export class ApiModule {
36
  static forRoot(params: ApiConfigurationParams): ModuleWithProviders<ApiModule> {
37
    return {
38
      ngModule: ApiModule,
39
      providers: [
40
        {
41
          provide: ApiConfiguration,
42
          useValue: params
43
        }
44
      ]
45
    }
46
  }
47
48 ea0e5344 hlavja
  constructor( 
49 f8b9a3a2 hlavja
    @Optional() @SkipSelf() parentModule: ApiModule,
50
    @Optional() http: HttpClient
51
  ) {
52
    if (parentModule) {
53
      throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
54
    }
55
    if (!http) {
56
      throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
57
      'See also https://github.com/angular/angular/issues/20575');
58
    }
59
  }
60
}