Below is the code snippet I am working with:
@NgModule({
imports: [
..
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (createTranslateLoader),
deps: [HttpClient]
}
}),
...
],
The implementation of createTranslateLoader function look like this:
export function createTranslateLoader(http: HttpClient) {
let fullLocationPath = location.origin + location.pathname;
// Trying to access Angular's location service here.
return new TranslateHttpLoader(http, fullLocationPath + 'assets/languages/', '.json');
}
I'm having trouble using Angular's location service in the createTranslateLoader function. Any suggestions or documentation on how to achieve this? Check out the Angular Location API for more information.