epic_explorer/src/app/app.module.ts

60 lines
1.8 KiB
TypeScript
Raw Normal View History

2019-06-27 06:48:08 +00:00
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
2019-07-09 09:22:36 +00:00
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
2019-06-27 06:48:08 +00:00
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
2019-07-19 14:05:06 +00:00
import { HttpClientModule, HttpClient, HttpParams } from '@angular/common/http';
2019-07-19 09:46:52 +00:00
import { CookieService } from 'ngx-cookie-service';
import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
import { TransServiceService } from './shared/services/trans-service.service';
2019-07-19 14:05:06 +00:00
import { ChartService} from './shared/services/chart.service';
2019-06-27 06:48:08 +00:00
import { NotFoundComponent } from './view/home/not-found/not-found.component';
2019-07-19 09:46:52 +00:00
import { Observable, of } from 'rxjs';
import { map, catchError } from 'rxjs/operators';
2019-07-19 14:05:06 +00:00
export class CustomLoader extends ChartService implements TranslateLoader {
2019-07-19 09:46:52 +00:00
apiHost: string;
2019-07-19 14:05:06 +00:00
constructor(public http: HttpClient ) {
super(http)
2019-07-19 09:46:52 +00:00
}
2019-07-19 14:05:06 +00:00
public getTranslation(lang): Observable<any> {
2019-07-19 09:46:52 +00:00
2019-07-19 14:05:06 +00:00
let params = new HttpParams();
params = params.append('lang', lang);
return this.apiGetRequest(params,'/blockchain_kernel/translator').pipe(
2019-07-19 09:46:52 +00:00
map((res: any) => {
return res;
})
2019-07-19 14:05:06 +00:00
);
2019-07-19 09:46:52 +00:00
}
}
2019-06-27 06:48:08 +00:00
@NgModule({
declarations: [
AppComponent,NotFoundComponent
],
imports: [
BrowserModule.withServerTransition({ appId: 'serverApp' }),
HttpClientModule,
AppRoutingModule,
2019-07-09 09:22:36 +00:00
BrowserAnimationsModule,
2019-07-19 09:46:52 +00:00
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useClass: CustomLoader,
// useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
})
2019-06-27 06:48:08 +00:00
],
2019-07-19 14:05:06 +00:00
providers: [TransServiceService,CookieService,ChartService],
2019-07-19 06:06:21 +00:00
bootstrap: [AppComponent]
2019-06-27 06:48:08 +00:00
})
2019-07-19 14:05:06 +00:00
export class AppModule {
constructor( ) {
}
}