101 lines
3.4 KiB
TypeScript
101 lines
3.4 KiB
TypeScript
import { BrowserModule } from '@angular/platform-browser';
|
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
import { NgModule, Provider, APP_INITIALIZER } from '@angular/core';
|
|
|
|
import { AppRoutingModule } from './app-routing.module';
|
|
import { AppComponent } from './app.component';
|
|
import { HomeComponent } from './control-panel/home/home.component';
|
|
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
|
|
import { AlertModule } from 'ngx-bootstrap/alert';
|
|
import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';
|
|
import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
|
|
import { CarouselModule } from 'ngx-bootstrap/carousel';
|
|
import { BorderCardDirective } from './_helpers/_directives/border-card.directive';
|
|
import { ToolbarModule } from 'primeng/toolbar';
|
|
import { ButtonModule } from 'primeng/button';
|
|
import { SplitButtonModule } from 'primeng/splitbutton';
|
|
import { DialogModule } from 'primeng/dialog';
|
|
import { InputTextModule } from 'primeng/inputtext';
|
|
import { ApiConfiguration } from './_api/api-configuration';
|
|
import { AppService } from './_services/app.service';
|
|
import { FormsModule } from '@angular/forms';
|
|
import { CalendarModule } from 'primeng/calendar';
|
|
|
|
import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
|
|
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
|
|
import { AuthenticationService } from './_services/authentication.service';
|
|
import { ConfigComponent } from './control-panel/profile/config/config.component';
|
|
import { NotFoundComponent } from './control-panel/not-found/not-found.component';
|
|
import { ProfileComponent } from './control-panel/profile/profile/profile.component';
|
|
import { EditProfileComponent } from './control-panel/profile/edit-profile/edit-profile.component';
|
|
import { JwtInterceptor } from './_helpers/jwt.interceptor';
|
|
import { ErrorInterceptor } from './_helpers/error.interceptor';
|
|
|
|
|
|
|
|
|
|
export function initApiConfiguration(config: ApiConfiguration): Function {
|
|
return () => {
|
|
config.rootUrl='https://localhost:5001'; // None = same rooturl
|
|
};
|
|
}
|
|
|
|
export const INIT_API_CONFIGURATION: Provider = {
|
|
provide:APP_INITIALIZER,
|
|
useFactory:initApiConfiguration,
|
|
deps: [ApiConfiguration],
|
|
multi:true
|
|
};
|
|
|
|
// AoT requires an exported function for factories
|
|
export function HttpLoaderFactory(http: HttpClient) {
|
|
return new TranslateHttpLoader(http);
|
|
}
|
|
|
|
|
|
@NgModule({
|
|
declarations: [
|
|
AppComponent,
|
|
HomeComponent,
|
|
BorderCardDirective,
|
|
ConfigComponent,
|
|
NotFoundComponent,
|
|
ProfileComponent,
|
|
EditProfileComponent
|
|
],
|
|
imports: [
|
|
BrowserModule,
|
|
BrowserAnimationsModule,
|
|
AppRoutingModule,
|
|
AlertModule.forRoot(),
|
|
BsDatepickerModule.forRoot(),
|
|
BsDropdownModule.forRoot(),
|
|
CarouselModule.forRoot(),
|
|
ToolbarModule,
|
|
ButtonModule,
|
|
SplitButtonModule,
|
|
DialogModule,
|
|
InputTextModule,
|
|
HttpClientModule,
|
|
FormsModule,
|
|
CalendarModule,
|
|
TranslateModule.forRoot({
|
|
loader: {
|
|
provide: TranslateLoader,
|
|
useFactory: HttpLoaderFactory,
|
|
deps: [HttpClient]
|
|
}
|
|
})
|
|
],
|
|
providers: [
|
|
INIT_API_CONFIGURATION,
|
|
AppService,
|
|
AuthenticationService,
|
|
{ provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true },
|
|
{ provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true },
|
|
],
|
|
bootstrap: [AppComponent]
|
|
})
|
|
export class AppModule { }
|