debian/bullseye
|
Last change
on this file since a82ff18 was 5e4cb73, checked in by Joachim Langenbach <joachim.langenbach@…>, 8 years ago |
|
Refactored mapservice
- mapservice is a connexion python webservice with openapi defined api
- mapservice-webclient is a angular app, consuming the openapi webservice mapservice
|
-
Property mode
set to
100644
|
|
File size:
1.1 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 { UsersService } from './api/users.service';
|
|---|
| 7 | import { WatersService } from './api/waters.service';
|
|---|
| 8 |
|
|---|
| 9 | @NgModule({
|
|---|
| 10 | imports: [],
|
|---|
| 11 | declarations: [],
|
|---|
| 12 | exports: [],
|
|---|
| 13 | providers: [
|
|---|
| 14 | UsersService,
|
|---|
| 15 | WatersService ]
|
|---|
| 16 | })
|
|---|
| 17 | export class ApiModule {
|
|---|
| 18 | public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders {
|
|---|
| 19 | return {
|
|---|
| 20 | ngModule: ApiModule,
|
|---|
| 21 | providers: [ { provide: Configuration, useFactory: configurationFactory } ]
|
|---|
| 22 | };
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | constructor( @Optional() @SkipSelf() parentModule: ApiModule,
|
|---|
| 26 | @Optional() http: HttpClient) {
|
|---|
| 27 | if (parentModule) {
|
|---|
| 28 | throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
|
|---|
| 29 | }
|
|---|
| 30 | if (!http) {
|
|---|
| 31 | throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
|
|---|
| 32 | 'See also https://github.com/angular/angular/issues/20575');
|
|---|
| 33 | }
|
|---|
| 34 | }
|
|---|
| 35 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.