-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathapp.module.ts
More file actions
66 lines (63 loc) · 2.78 KB
/
app.module.ts
File metadata and controls
66 lines (63 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { Location, LocationStrategy, PathLocationStrategy } from '@angular/common';
import { APP_INITIALIZER, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { KeycloakAngularModule, KeycloakService } from 'keycloak-angular';
import { HTTP_INTERCEPTORS, HttpClient } from '@angular/common/http';
import { BidiModule } from '@angular/cdk/bidi';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { DateFnsModule } from 'ngx-date-fns';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { initializeAuth } from './shared/auth/init-auth';
import { SharedModule } from './shared/shared.module';
import { ENV, getEnv } from '../environments/getEnv';
import { AuthService } from './shared/auth/auth-service/auth.service';
import { DynamicFormModule } from './shared/dynamic-form/dynamic-form.module';
import { MenuComponent } from './_common-components/menu/menu.component';
import { ApiInterceptor } from './_interceptors/ApiInterceptor';
import { NotFoundComponent } from './_common-components/not-found/not-found.component';
import { HelperService } from './_services/helper.service';
import { ErrorInterceptor } from './_interceptors/error.interceptor.service';
import { SideMenuComponent } from './_common-components/side-menu/side-menu.component';
import {MatIconModule} from "@angular/material/icon";
export function HttpLoaderFactory(http: HttpClient): any {
return new TranslateHttpLoader(http, 'assets/i18n/');
}
@NgModule({
declarations: [AppComponent, MenuComponent, NotFoundComponent, SideMenuComponent],
imports: [
BrowserModule,
AppRoutingModule,
SharedModule,
KeycloakAngularModule,
BrowserAnimationsModule,
BidiModule,
DynamicFormModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient],
},
}),
DateFnsModule.forRoot()
],
providers: [
{ provide: ENV, useFactory: getEnv },
Location,
{ provide: LocationStrategy, useClass: PathLocationStrategy },
{ provide: AuthService, useClass: getEnv().isLegacyLogin ? AuthService : KeycloakService },
{ provide: HTTP_INTERCEPTORS, useClass: ApiInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true },
{
provide: APP_INITIALIZER,
useFactory: initializeAuth,
multi: true,
deps: [AuthService, Location, HttpClient, HelperService, ENV],
},
],
bootstrap: [AppComponent],
})
export class AppModule {}