Answer the question
In order to leave comments, you need to log in
How to take a function out of app.module and inject a service into it to get settings?
there is such function in app.module.ts
export function exportTranslateStaticLoader(http: HttpClient, transferState: TransferState, cookie: CookieService) {
let apiUrl;
if (environment.browser.symphonyApiUrl) {
apiUrl = environment.browser.symphonyApiUrl;
} else {
const protocol = window.location.protocol;
const host = window.location.host;
apiUrl = `${protocol}//api.${host}`;
}
const link = environment.remoteTranslate ? `${apiUrl}/cms/locale/` : '/assets/i18n/';
return new TranslateBrowserLoader(link, '.json', transferState, http, cookie);
}
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: exportTranslateStaticLoader,
deps: [HttpClient, TransferState, CookieService]
}
}),
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question