I am trying to create a complex reactive form with nested component that is populated with a data object.
The behavior I am trying to achieve is very similar to the two-way data binding of a template-driven form: when the user edits an input of the form, the data object is changing automatically.
but as opposed to template-driven form, I cannot use [(ngModel)]
because it is deprecated in reactive forms for angular V6.
I know that fromGroup.patchValue()
will only do a one way binding and then ill have to manually subscribe to change events and update the data object manually - this will result in a lot of tiring code.
Is there any workaround for that scenario?
form.value
object has already the last form value, why would you needngModel
? – ibenjelloun