Merge pull request #1372 from tonic889/issue-1366
fix(core.module.ts): change translation service to consider base url
This commit is contained in:
@@ -38,6 +38,9 @@ import { SidenavComponent } from './shell/sidenav/sidenav.component';
|
|||||||
import { ToolbarComponent } from './shell/toolbar/toolbar.component';
|
import { ToolbarComponent } from './shell/toolbar/toolbar.component';
|
||||||
import { BreadcrumbComponent } from './shell/breadcrumb/breadcrumb.component';
|
import { BreadcrumbComponent } from './shell/breadcrumb/breadcrumb.component';
|
||||||
import { ContentComponent } from './shell/content/content.component';
|
import { ContentComponent } from './shell/content/content.component';
|
||||||
|
import { InjectionToken } from '@angular/core';
|
||||||
|
import { APP_BASE_HREF, LocationStrategy } from '@angular/common';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Core Module
|
* Core Module
|
||||||
@@ -51,10 +54,10 @@ import { ContentComponent } from './shell/content/content.component';
|
|||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useFactory: (http: HttpClient) => {
|
useFactory: (http: HttpClient, locationStrategy: LocationStrategy) => {
|
||||||
return new TranslateHttpLoader(http, `${ window.location.protocol }//${ window.location.host }/assets/translations/`, '.json');
|
return new TranslateHttpLoader(http, `${ window.location.protocol }//${ window.location.host }${locationStrategy.getBaseHref()}/assets/translations/`, '.json');
|
||||||
},
|
},
|
||||||
deps: [HttpClient]
|
deps: [HttpClient, LocationStrategy]
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
RouterModule
|
RouterModule
|
||||||
|
|||||||
Regular → Executable
Reference in New Issue
Block a user