Sorry for this question. This is to do with one of my child component which rejecting null, empty string while writing to form.
I have a form control orderNo.
When I try to do
this.myForm.controls['orderNo'].setValue = '123';
It works fine and my view is updated with this value.
But the issue is, I am not able to set the control with null or empty string. Whenever I do
this.myForm.controls['orderNo'].setValue = null;
or
this.myForm.controls['orderNo'].setValue = '';
it doesn't reflect on my view.
But I could see the form control holds that null value. (ng.probe($0).componentInstance.myForm.controls['orderNo'].value returns null).
It is just not being reflected on the view.
Please help me with some thoughts. Thank you.
You can directly use patchValue to set value of form fields
this.myForm.patchValue( {'orderNo':null} );