MrWolfZ / ngrx-forms

Enhance your forms in Angular applications with the power of ngrx
MIT License
374 stars 111 forks source link

Including ReactiveFormsModule and NgrxFormsModule in angular 8 doesn't work #172

Closed dkowis closed 4 years ago

dkowis commented 4 years ago

All you have to do is import the ReactiveForms module ahead of the NgrxForms module, as described in the docs.

  1. ng cli 8.x
  2. ng new sample
  3. ng add @ngrx/store
  4. npm install ngrx-forms
  5. import the ReactiveFormsModule ahead of NgrxFormsModule
  6. create a form
  7. Reach this explosion: image

Sample application: https://github.com/dkowis/ngrx-test/tree/reactive-forms-fail

MrWolfZ commented 4 years ago

This has nothing to do with ngrx-forms (you can see the same error if you remove all ngrx-forms code from your example). The problem is how you use angular forms. If you only use reactive forms, you need to bind the form to a form group (see also this SO question). Alternatively, you can just also import the FormsModule in addition to the ReactiveFormsModule which will cause the form to fall back to a template form (at least that's what I believe, I haven't used angular forms in ages due to ridiculous issues like this).