/**
* @license
* Copyright Akveo. All Rights Reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
import {APP_BASE_HREF} from '@angular/common';
import {BrowserModule, BrowserTransferStateModule} from '@angular/platform-browser';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {NgModule} from '@angular/core';
import {HTTP_INTERCEPTORS, HttpClient, HttpClientModule} from '@angular/common/http';
import {CoreModule} from './@core/core.module';
import {AppComponent} from './app.component';
import {AppRoutingModule} from './app-routing.module';
import {ThemeModule} from './@theme/theme.module';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
import {TranslateLoader, TranslateModule} from '@ngx-translate/core';
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
import {BaseurlInterceptor} from './config/interceptors/baseurl.interceptor';
import {TokenInterceptor} from './config/interceptors/token.interceptor';
import {ToasterModule} from 'angular2-toaster';
import {NotificationInterceptor} from './config/interceptors/notification.interceptor';
import {ServiceWorkerModule} from '@angular/service-worker';
import {environment} from '../environments/environment';
import {NbMenuService} from "@nebular/theme";
import {NgxCommon} from "./common/common.module";
// AoT requires an exported function for factories
export function HttpLoaderFactory(httpClient: HttpClient) {
return new TranslateHttpLoader(httpClient);
}
@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule.withServerTransition({appId: 'chidna'}),
BrowserAnimationsModule,
BrowserTransferStateModule,
HttpClientModule,
AppRoutingModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient],
},
}),
NgbModule.forRoot(),
ThemeModule.forRoot(),
CoreModule.forRoot(),
ToasterModule.forRoot(),
ServiceWorkerModule.register('/ngsw-worker.js', {enabled: environment.production}),
NgxCommon,
],
bootstrap: [AppComponent],
providers: [
NbMenuService,
{provide: APP_BASE_HREF, useValue: '/'},
{
provide: HTTP_INTERCEPTORS,
useClass: BaseurlInterceptor,
multi: true,
},
{
provide: HTTP_INTERCEPTORS,
useClass: TokenInterceptor,
multi: true,
}, {
provide: HTTP_INTERCEPTORS,
useClass: NotificationInterceptor,
multi: true,
},
],
})
export class AppModule {
}