Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 4ccb6b62

Přidáno uživatelem Pavel Fidransky před asi 5 roky(ů)

re #33: load frontend app configuration from config.json file

Zobrazit rozdíly:

webapp/src/app/app.module.ts
1 1
import {BrowserModule} from '@angular/platform-browser';
2
import {NgModule} from '@angular/core';
2
import {NgModule, APP_INITIALIZER} from '@angular/core';
3 3

  
4 4
import {AppRoutingModule} from './app-routing.module';
5 5
import {AppComponent} from './app.component';
......
18 18
import {BasicAuthInterceptor} from "./auth/basic-auth.interceptor";
19 19
import {LoginComponent} from "./login/login.component";
20 20

  
21
import {loadConfig} from './loadConfig';
22
import {Config} from './services/util/config.service';
23

  
21 24
@NgModule({
22 25
  declarations: [
23 26
    AppComponent,
......
45 48
    CommonModule
46 49
  ],
47 50
  providers: [
48
    {provide: HTTP_INTERCEPTORS, useClass: BasicAuthInterceptor, multi: true}
51
    {
52
      provide: HTTP_INTERCEPTORS,
53
      useClass: BasicAuthInterceptor,
54
      multi: true,
55
    },
56
    {
57
      provide: APP_INITIALIZER,
58
      useFactory: loadConfig,
59
      deps: [
60
        HttpClient,
61
        Config,
62
      ],
63
      multi: true
64
    },
49 65
  ],
50 66
  bootstrap: [AppComponent]
51 67
})

Také k dispozici: Unified diff