【发布时间】:2017-02-21 16:30:53
【问题描述】:
使用最新的Angular2 Webpack Starter (v5.4.1. / Angular 2.4.6) 我正在尝试使用 AoT 编译器构建我的代码。在自定义表单输入组件中,我有这个 host binding
@Component({
selector: 'my-selector',
templateUrl: 'mycustominput.component.html',
host: {'(input-blur)': 'onInputBlur($event:any)'},
providers: [INPUT_VALUE_ACCESSOR]
})
使用npm run build:aot:prod 运行的构建失败并显示此消息
[at-loader] Checking finished with 2 errors
Error in bail mode: [at-loader] compiled/src/app/views/mycustominput.component.ngfactory.ts:142:35
TS2346: Supplied parameters do not match any signature of call target.
ngfactory 中的相应行 (142) 是这样的:
141 if ((eventName == 'input-blur')) {
142 const pd_sub_0:any = ((<any>this.context.onInputBlur($event)) !== false);
143 result = (pd_sub_0 && result);
144 }
显然它与主机绑定有关。开发构建中的此代码被 JIT 编译没有问题。任何想法如何解决这个问题?
【问题讨论】:
标签: angular compiler-errors aot angular2-hostbinding