I am trying to build app with -aot
option (ng build -aot
). I’ve got the following error:
ERROR in Error during template compile of 'MyComponent'
Function calls are not supported in decorators but 'classLogger' was called in 'cLog'
'cLog' calls 'classLogger'.
However I need this calls and I don’t have an idea how I am supposed to change the code to make it work.
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. Class decorator takes options which must be transferred to decorator patch callback.