argos/dmp-frontend/src/app/projects/projects.module.ts

54 lines
1.6 KiB
TypeScript
Raw Normal View History

2018-01-30 10:35:26 +01:00
import { BaseHttpService } from '../utilities/cite-http-service-module/base-http.service';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';
import { ProjectEditorComponent } from './editor/project-editor.component';
import { ProjectListingComponent } from './listing/project-listing.component';
import { ProjectRoutes } from './project.routes';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { SharedModule } from '../shared/shared.module'
import { NgModule } from '@angular/core';
@NgModule({
imports: [
CommonModule,
FormsModule,
HttpClientModule,
SharedModule,
ProjectRoutes,
ReactiveFormsModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
}),
],
declarations: [
ProjectListingComponent,
ProjectEditorComponent
],
exports: [
ProjectListingComponent,
ProjectEditorComponent,
], providers: [
BaseHttpService
]
})
export class ProjectsModule {
constructor(private translate: TranslateService) {
translate.setDefaultLang('en');
translate.use('en');
}
}
export function HttpLoaderFactory(httpClient: HttpClient) {
return new TranslateHttpLoader(httpClient, 'assets/lang/', '.json');
}