I've created a ControlGroup theForm
using FormBuilder.
When I tried to update value of a control like this
this.theForm.find('MainImageId').updateValue( id, true, true);
It worked fine but WebStorm shows an error saying
Error:(148, 24) TS2339: Property 'updateValue' does not exist on type 'AbstractControl'.
What am I doing wrong? and why does it work?
According to Typescript casting object's property I guess this should fix it
find
is now 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});
Edit: Optional parameters are supplied as an Object in second parameter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With