Angular2:错误 - 属性 'updateValue' 在类型 'AbstractControl' 上不存在
Angular2: Error - Property 'updateValue' does not exist on type 'AbstractControl'
我使用 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 casting object's property 我想这应该可以解决
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});
编辑:可选参数在第二个参数中作为对象提供。
我使用 FormBuilder.
创建了一个 ControlGrouptheForm
当我尝试像这样更新控件的值时
this.theForm.find('MainImageId').updateValue( id, true, true);
它运行良好,但 WebStorm 显示错误
Error:(148, 24) TS2339: Property 'updateValue' does not exist on type 'AbstractControl'.
我做错了什么?为什么有效?
根据 Typescript casting object's property 我想这应该可以解决
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});
编辑:可选参数在第二个参数中作为对象提供。