Currently, in my application, I am utilizing Transloco for translation purposes. The @NgModule I am using is outlined below.
@NgModule({
exports: [TranslocoModule],
providers: [
{
provide: TRANSLOCO_CONFIG,
useValue: translocoConfig({
availableLangs: MyService().getLanguages(),
defaultLang: 'en',
fallbackLang: 'en',
reRenderOnLangChange: true,
prodMode: environment.production,
})
},
{ provide: TRANSLOCO_LOADER, useClass: TranslocoHttpLoader }
]
})
The MyService class triggers an external API call and includes HttpClient in its constructor. I am trying to set the availableLangs parameter by invoking getLanguages() and injecting HttpClient within MyService(...). However, I am facing a challenge in injecting dependencies in the @NgModule.
Is it feasible to achieve this or are there any other solutions available?