AoT编译中的Angular2主机绑定问题
203 观看
1回复
使用最新的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.
中的相应行(142)ngfactory
是:
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编译的开发版本中,此代码没有问题。任何想法如何解决这一问题?
作者: Matt 的来源 发布者: 2019 年 10 月 8 日回应 (1)
0像
决定
哦,我的坏。event
AoT现在抱怨的只是我组件中的回调方法中缺少的参数。
变了
public onInputBlur() {...}
至
public onInputBlur(event) {...}
作者: Matt
发布者: 21.02.2017 04:40
来自类别的问题 :
- angular 如何查看我使用的Angular版本?
- angular AngularJS:如何清除URL中的查询参数?
- angular angular:根据模型中的布尔值切换按钮文本
- angular Angular 2:是否强制使用括号/方括号?
- angular 在最新的TypeScript(大概是v1.5)示例中,@(符号)是什么意思?
- compiler-errors 定位的程序集的清单定义与程序集引用不匹配
- compiler-errors 任何MSI安装项目上的“不可恢复的构建错误”
- compiler-errors Resolve build errors due to circular dependency amongst classes
- compiler-errors 如何在一行上连接多个C ++字符串?
- compiler-errors JSLint是否可供脱机使用?
- aot 如何将ByteCode转换为机器本机代码
- aot 是否可以使用Mono AOT编译(本机)c#可执行文件和C#Dll(CIL),它具有未实现的单声道方法
- aot 简短说明是否有更好的表现?
- aot 我想要从企业门户禁用操作窗格按钮
- aot AOT编译器将收缩Docker容器
- angular2-hostbinding AoT编译中的Angular2主机绑定问题
- angular2-hostbinding 在Angular 2中使用@HostBinding对模板子元素进行mouseenter / mouseleave时更改主机类
- angular2-hostbinding 角度2:获取HTML元素的位置
- angular2-hostbinding 使用angular2 @HostListener时onbeforeunload确认对话框不显示
- angular2-hostbinding 角@Hostbinding不起作用