Projekt

Obecné

Profil

Stáhnout (1.55 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 { GroupService } from './services/group.service';
9
import { DataService } from './services/data.service';
10
import { AnalyticsService } from './services/analytics.service';
11
import { ManagementService } from './services/management.service';
12
import { SensorsService } from './services/sensors.service';
13

    
14
/**
15
 * Module that provides all services and configuration.
16
 */
17
@NgModule({
18
  imports: [],
19
  exports: [],
20
  declarations: [],
21
  providers: [
22
    LoginService,
23
    GroupService,
24
    DataService,
25
    AnalyticsService,
26
    ManagementService,
27
    SensorsService,
28
    ApiConfiguration
29
  ],
30
})
31
export class ApiModule {
32
  static forRoot(params: ApiConfigurationParams): ModuleWithProviders<ApiModule> {
33
    return {
34
      ngModule: ApiModule,
35
      providers: [
36
        {
37
          provide: ApiConfiguration,
38
          useValue: params
39
        }
40
      ]
41
    }
42
  }
43

    
44
  constructor( 
45
    @Optional() @SkipSelf() parentModule: ApiModule,
46
    @Optional() http: HttpClient
47
  ) {
48
    if (parentModule) {
49
      throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
50
    }
51
    if (!http) {
52
      throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
53
      'See also https://github.com/angular/angular/issues/20575');
54
    }
55
  }
56
}
(2-2/7)