When trying to compile my RC6 app using the following command:
ngc -p C:\Path\To\Project
(I am placed inside C:\Path\To\Project\node_modules\.bin when I'm running the command)
I get the following error:
Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 20:25 in the original .ts file), resolving symbol CoreModule in C:/Path/To/Project/app/modules/core/core.module.ts
This is what it complains about:
@NgModule({
imports: [
CommonModule,
TranslateModule.forRoot({
provide: TranslateLoader,
useFactory: (http: Http) => new TranslateStaticLoader(http, 'app/languages', '.json'),
deps: [Http]
})
],
If I remove TranslateModule.forRoot... the error disappears.
How do I replace this with an exported function as the error implies?
I'm having some luck doing this:
export function translateStaticLoaderFactory(http: Http) {
return new TranslateStaticLoader(http, 'app/languages', '.json');
}
@NgModule({
imports: [
CommonModule,
TranslateModule.forRoot({
provide: TranslateLoader,
useFactory: translateStaticLoaderFactory,
deps: [Http]
})
],
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With