Projekt

Obecné

Profil

Stáhnout (1.74 KB) Statistiky
| Větev: | Tag: | Revize:
1
/* 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
import { AdministrationService } from './services/administration.service';
9
import { SensorsService } from './services/sensors.service';
10
import { ObservationService } from './services/observation.service';
11
import { GroupService } from './services/group.service';
12
import { DataService } from './services/data.service';
13
import { AnalyticsService } from './services/analytics.service';
14
import { ManagementService } from './services/management.service';
15

    
16
/**
17
 * Module that provides all services and configuration.
18
 */
19
@NgModule({
20
  imports: [],
21
  exports: [],
22
  declarations: [],
23
  providers: [
24
    LoginService,
25
    AdministrationService,
26
    SensorsService,
27
    ObservationService,
28
    GroupService,
29
    DataService,
30
    AnalyticsService,
31
    ManagementService,
32
    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
  constructor( 
49
    @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
}
(2-2/7)