When I include TranslateModule
using the following code:
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
})
where
export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http, "./assets/i18n/", ".json");
}
everything functions correctly. However, if I switch to an arrow function:
export const HttpLoaderFactory = (http: HttpClient) => new TranslateHttpLoader(http, "./assets/i18n/", ".json");
I encounter this error:
Uncaught ReferenceError: Cannot access 'HttpLoaderFactory' before initialization
at Module.HttpLoaderFactory (app.component.ts:18:26)
at Module.10617 (core-components.module.ts:18:29)
at __webpack_require__ (bootstrap:19:1)
...
Why is this issue occurring?
Appreciate any help!