Angular decorator中不支持函数调用

Angular decorator中不支持函数调用,angular,decorator,aot,Angular,Decorator,Aot,我正在尝试使用-aot选项(ng build-aot)构建应用程序。我有以下错误: ERROR in Error during template compile of 'MyComponent' Function calls are not supported in decorators but 'classLogger' was called in 'cLog' 'cLog' calls 'classLogger'. 但是,我需要这些调用,我不知道如何更改代码以使其工作 expo

我正在尝试使用
-aot
选项(
ng build-aot
)构建应用程序。我有以下错误:

ERROR in Error during template compile of 'MyComponent'
  Function calls are not supported in decorators but 'classLogger' was called in 'cLog'
    'cLog' calls 'classLogger'.
但是,我需要这些调用,我不知道如何更改代码以使其工作

export function classLogger(_classOptions?) {
   const myLogger = new MyLogger();
   myLogger.options = Object.assign({}, defaultClassOptions, _classOptions);

   return myLogger.loggerCB;
}

// export function clog(options = defaultClassOptions): Function {
export function cLog(options?): Function {
   return loggingEnabled ? classLogger(options) : emptyClassDecorator();
}

p.S.类decorator接受必须转移到decorator补丁回调的选项。

我也遇到了这个问题。在我的情况下,我想覆盖BusyConfig参数。应用程序可以正常使用
ng serve
,但是当我想为生产构建应用程序时,
函数调用在decorators中不受支持,但是…
出现异常

我的解决办法如下:
ng build--prod--aot=false

角度提前(AOT)编译器将转换角度HTML 并在构建过程中将脚本代码键入高效的JavaScript代码 浏览器下载并运行该代码之前的阶段


ng build--prod
ng build--prod--aot

相同,您的解决方案无法解决任何问题。我遇到了这个问题,特别是想使用AOT。AOT对于生产至关重要。看起来@angular/cli 1.6.8解决了这个问题。。。