I have noticed that if I disable a control on an Angular 2 reactive form then the control does not get included in the form.value. For example, if I define my form like bel
Thank you @Sasxa for getting me 80% what I needed.
For those of you looking for a solution to the same problem but for nested forms I was able to solve by changing my usual
this.notelinkingForm.get('nestedForm').value
to
this.notelinkingForm.getRawValue().nestedForm
Another option that I use is:
this.form.controls['LinkToPreceeding'].value;
You can use:
this.notelinkingForm.getRawValue()
From Angular docs:
If you'd like to include all values regardless of disabled status, use this method. Otherwise, the
value
property is the best way to get the value of the group.
If you use readonly
instead of disabled
it's still not editable while the data will be included in the form. But that isn't possible in all cases. E.g. it's not available for radio buttons and checkboxes. See MDN web docs. In those cases you have to apply for the other solutions provided here.