-
Notifications
You must be signed in to change notification settings - Fork 15
Update so it works with Reactive forms #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@SethDavenport Not sure if you are the right person to bug but what needs to happen to get this reviewed and brought in? |
Sorry for the delay on this - I actually haven't been super involved with angular-redux/form - I'm mostly the store and example-app guy. Unfortunately /form needs a new maintainer, and possibly a re-think, as you may have noticed. My personal take is that we never intended to support the formBuilder stuff; in practice template-driven forms are much more declarative and therefore preferable. @danielfigueiredo @clbond any thoughts on this change? It seems reasonable to me, but you have more experience with complex forms in Angular than I do. |
source/connect-base.ts
Outdated
} | ||
else{ | ||
formElement = this.form.control; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed up.
README.md
Outdated
@@ -203,6 +207,15 @@ the `path` property on our first `<select>` element, it would look like this: | |||
From there, `@angular-redux/form` is able to take that path and extract the value for | |||
that element from the Redux state. | |||
|
|||
#### Reactive Forms | |||
The value in "connect" attribute is the value that will show up in the Redux store. The formGrup value is the name of hte object in your code that represents the form group. | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are few typos here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected.
source/module.ts
Outdated
ConnectArray, | ||
], | ||
exports: [ | ||
Connect, | ||
ConnectTemplateDirective, | ||
ConnectReactiveDirective, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This represents a breaking API change - is there any way we can avoid this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how, as the source of the form has now changed between the two. Maybe we can keep the template class named "connect" so that class stays the same for people plugged in for template driven forms? Then, at least to me, the name of the class is less declarative on what it does but may be an option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for a breaking change.
Connect
andReactiveConnect
are fine, too.
In @angular/forms
its similar:
FormsModule
ReactiveFormsModule
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup I'm cool with that suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated PR based on this conversation to align.
Give @angular-redux/form@6.5.0 a whirl and let me know. |
Still have never gotten this to work. :/ Not once have I even seen a form show up in my state. Are the docs up to date? |
Address issue #22
Tested this locally with the code base that triggered the creation of this issue. Works for template and reactive. Locally the tests will not run but they also do not run with the main GIT master branch so seems to be a local issue. Please review and provide any feedback.