小编Mic*_*rle的帖子

angular2 AoT错误不支持函数调用

当我使用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)

javascript angularjs angular2-aot angular

3
推荐指数
1
解决办法
923
查看次数

标签 统计

angular ×1

angular2-aot ×1

angularjs ×1

javascript ×1