// angular import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { LocationStrategy, HashLocationStrategy } from '@angular/common'; import { HttpClientModule, HTTP_INTERCEPTORS, HttpClient } from '@angular/common/http'; // libs import { TranslateModule, TranslateLoader } from '@ngx-translate/core'; import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { LoadingBarRouterModule } from '@ngx-loading-bar/router'; import { LoadingBarHttpClientModule } from '@ngx-loading-bar/http-client'; import { NgScrollbarModule } from 'ngx-scrollbar'; // app import { CoreModule } from './core/core.module'; import { SharedModule } from './shared/shared.module'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { HeaderComponent } from './layout/header/header.component'; import { PageLoaderComponent } from './layout/page-loader/page-loader.component'; import { SidebarComponent } from './layout/sidebar/sidebar.component'; import { RightSidebarComponent } from './layout/right-sidebar/right-sidebar.component'; import { AuthLayoutComponent } from './layout/app-layout/auth-layout/auth-layout.component'; import { MainLayoutComponent } from './layout/app-layout/main-layout/main-layout.component'; import { ErrorInterceptor } from './core/interceptor/error.interceptor'; import { JwtInterceptor } from './core/interceptor/jwt.interceptor'; import { UpdateDateHttpInterceptor } from './core/interceptor/update.date.http.interceptor '; export function createTranslateLoader(http: HttpClient) { return new TranslateHttpLoader(http, 'assets/i18n/', '.json'); } @NgModule({ declarations: [ AppComponent, HeaderComponent, PageLoaderComponent, SidebarComponent, RightSidebarComponent, AuthLayoutComponent, MainLayoutComponent, ], imports: [ BrowserModule, BrowserAnimationsModule, AppRoutingModule, HttpClientModule, LoadingBarHttpClientModule, LoadingBarRouterModule, NgScrollbarModule, TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory: createTranslateLoader, deps: [HttpClient], }, }), // core & shared CoreModule, SharedModule, ], providers: [ { provide: LocationStrategy, useClass: HashLocationStrategy }, { provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true }, { provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true }, { provide: HTTP_INTERCEPTORS, useClass: UpdateDateHttpInterceptor, multi: true }, ], bootstrap: [AppComponent], }) export class AppModule { }