2016-11-28 65 views
0

试图为食谱指南中描述的整合国际化,
当我运行解压缩工具来生成XLF文件我得到以下错误:角2的i18n提取工具错误

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 52:19 in the original .ts file), resolving symbol OrchestratorModule in D:/workspace/frontend/my-app/src/app/orchestrator/orchestrator.module.ts

基本上在线路在模块声明的52中,有一个lambda为HTTP定义了一个自定义提供程序。 我只有i18n提取工具有这个问题。
以前有人遇到过这个吗?感谢

编辑:从51行代码,在模块的供应商部分:

{ 
     provide: Http, 
     useFactory: (backend: XHRBackend, defaultOptions: RequestOptions, 
        auth: AuthenticationService) => { 
     return new LoyHttp(
      backend, defaultOptions, auth); 
     }, 
     deps: [ 
     XHRBackend, RequestOptions, AuthenticationService 
     ] 
    } 
+0

你能显示代码吗? – Riscie

+1

我可以展示它的一部分 –

+0

仅供参考,它适用于构建服务和测试,我只能用i18n的解压工具得到这个错误 –

回答

0

尝试

export function loyHttp(backend: XHRBackend, defaultOptions: RequestOptions, 
        auth: AuthenticationService) { 

return new LoyHttp(backend, defaultOptions, auth); 

} 

    { provide: Http, useFactory: loyHttp, 
     deps: [XHRBackend, RequestOptions, AuthenticationService] 
    } 

我相信这是解决方案。