尝试编译我的应用时出现"Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol DeclarantModule"
错误。当模块具有forRoot
或StoreModule.provideStore(rootReducer)
函数调用时会发生这种情况。
如何解决?为什么会这样?我不明白它我认为它是带有配置的导入模块的原生角度2函数。
答案 0 :(得分:0)
我收到此错误,根据此帖https://stackoverflow.com/a/39344889/4956569提供角度'LOCALE_ID'
解决为错误消息建议...将其导出为函数...
发布的原始实现(不使用AOT编译)
{
provide: LOCALE_ID,
deps: [SettingsService], //some service handling global settings
useFactory: (settingsService) => settingsService.getLanguage() //returns locale string
}
我的固定实现(使用AOT编译)
{
provide: LOCALE_ID,
deps: [SettingsService], //some service handling global settings
useFactory: localeIdFactory
}
export function localeIdFactory(settingsService: SettingsService) {
return settings.getLanguage();
}