debian/bullseye
|
Last change
on this file since a52bd6d was d660d75, checked in by Joachim Langenbach <joachim.langenbach@…>, 6 years ago |
|
Added all generated code to the soruce tree, to avoid generation during package build time
|
-
Property mode
set to
100644
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
|
|---|
| 2 | import { Configuration } from './configuration';
|
|---|
| 3 | import { HttpClient } from '@angular/common/http';
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 | import { DevicesService } from './api/devices.service';
|
|---|
| 7 | import { LogsService } from './api/logs.service';
|
|---|
| 8 | import { TilesService } from './api/tiles.service';
|
|---|
| 9 | import { UsersService } from './api/users.service';
|
|---|
| 10 | import { WatersService } from './api/waters.service';
|
|---|
| 11 |
|
|---|
| 12 | @NgModule({
|
|---|
| 13 | imports: [],
|
|---|
| 14 | declarations: [],
|
|---|
| 15 | exports: [],
|
|---|
| 16 | providers: []
|
|---|
| 17 | })
|
|---|
| 18 | export class ApiModule {
|
|---|
| 19 | public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders<ApiModule> {
|
|---|
| 20 | return {
|
|---|
| 21 | ngModule: ApiModule,
|
|---|
| 22 | providers: [ { provide: Configuration, useFactory: configurationFactory } ]
|
|---|
| 23 | };
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | constructor( @Optional() @SkipSelf() parentModule: ApiModule,
|
|---|
| 27 | @Optional() http: HttpClient) {
|
|---|
| 28 | if (parentModule) {
|
|---|
| 29 | throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
|
|---|
| 30 | }
|
|---|
| 31 | if (!http) {
|
|---|
| 32 | throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
|
|---|
| 33 | 'See also https://github.com/angular/angular/issues/20575');
|
|---|
| 34 | }
|
|---|
| 35 | }
|
|---|
| 36 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.