【问题标题】:"Function calls are not supported. Consider replacing t he function or lambda with a reference to an exported function, resolving symbol"“不支持函数调用。考虑将函数或 lambda 替换为对导出函数的引用,解析符号”
【发布时间】:2017-06-10 08:48:15
【问题描述】:

在使用我的自定义组件时遇到以下问题。

错误:静态解析符号值时遇到错误。不支持函数调用。考虑更换 t 引用导出函数的函数或 lambda,解析 E:/AOT/systemjs-aot-16 中的符号 getValue 62901741/src/

core.ts

export function getValue(

 ):any{ return "";}

cus-component.ts

import { getValue } from './core.ts';
export let compTest = getValue();

app.module.ts

import { compTest } from './cus-component';

 @NgModule({
 imports: [BrowserModule, FormsModule, HttpModule,  RouterModule.forRoot(rootRouterConfig, { useHash: true })],
 declarations: [ HomeComponent,compTest ],
 bootstrap: [AppComponent]
})
export class AppModule { }

【问题讨论】:

  • 我认为您需要提供更多代码。完全不清楚这段代码在哪里。服务、组件、装饰器、类外、...
  • 你找到解决办法了吗?
  • 仅供参考 function f():any{ return "";} 太糟糕了

标签: angular typescript angular2-aot


【解决方案1】:

只是一个猜测,但也许它可以解决你的问题:

export function getValue() {
    () => '';
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-12-01
    • 2017-08-27
    • 1970-01-01
    • 2020-09-25
    • 2017-07-06
    • 1970-01-01
    • 2017-06-07
    相关资源
    最近更新 更多