Ank*_*ngh 7 webstorm typescript angular
我使用FormBuilder创建了一个ControlGroup .theForm
当我尝试更新这样的控件的值时
this.theForm.find('MainImageId').updateValue( id, true, true);
它工作正常,但WebStorm显示错误说
Error:(148, 24) TS2339: Property 'updateValue' does not exist on type 'AbstractControl'.
我究竟做错了什么?为什么它有效?
根据Typescript投射对象的属性,我想这应该修复它
find现在get(> = RC.5)
(<Control> this.theForm.find('MainImageId')) .updateValue( id, {onlySelf:true, emitEvent:true});
// (<Control> this.theForm.find('MainImageId')) .updateValue( id, {onlySelf:true, emitEvent:true});
Run Code Online (Sandbox Code Playgroud)
编辑:可选参数作为第二个参数中的对象提供.
| 归档时间: |
|
| 查看次数: |
1956 次 |
| 最近记录: |