当我使用angular2 AoT时,我收到一个错误:
Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 54:17 in the original .ts file), resolving symbol COMPILER_PROVIDERS in
Run Code Online (Sandbox Code Playgroud)
在我的指令模块中,我有这样的代码:
import { COMPILER_PROVIDERS } from '@angular/compiler';
@NgModule({
/*imports ...*/
providers: [
COMPILER_PROVIDERS,
]
})
Run Code Online (Sandbox Code Playgroud)
我知道我应该将COMPILER_PROVIDERS更改为导出的函数,但是当我检查@ angular/compiler的源代码时,我发现:
export declare const COMPILER_PROVIDERS: Array<any | Type<any> | {
[k: string]: any;
} | any[]>;
export declare class RuntimeCompilerFactory implements CompilerFactory {
private _defaultOptions;
constructor(defaultOptions: CompilerOptions[]);
createCompiler(options?: CompilerOptions[]): Compiler;
} …Run Code Online (Sandbox Code Playgroud)