-
Notifications
You must be signed in to change notification settings - Fork 11
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
Setting values #26
Comments
Do you have an idea for the API surface, of a set for starters? That is what I would think would be the first method to base things off of. Control values as Provided I am correct in that assumption, In my head it would be like form = createFormGroup<{ name: string; age: number | null }>({
name: 'Alice',
age: null,
});
someMethodThatSetsValue() {
// Verbose name, but I imagine `.set()` would be confusing since it isn't a `WritableSignal`
this.form.setFormGroupValue({ name: 'Jerry', age: 20 })
} |
That seems good to me @michael-small ! |
I'll take a look into this approach then.
For the time being with my attempt I'll just start with the more verbose phrasing and if I actually get an implementation going then I suppose we would re-evaluate. Interested in hearing from anyone else reading this, since we are 1 vs 1 leaning on one solution but open to the other (minus the fact you are the owner and I am just some random person lol). Edit: as an aside, it was nice to hear about this library referenced at different times at ng-conf this year. @timdeschryver did you hear some of the news/buzz on forms from the conference? Edit 2: or, were you there and I didn't see you? |
Oh cool, that's nice to hear. I wasn't at ng-conf and I wasn't aware that it was talked about in the hallway. |
Update on this issue: I have a somewhat working version of the group setter going. I think it is rather naive and missing some things, but it is coming along. I am comparing it with a reactive form on the same page with the form group filler and individual control prefills. I'm sure of course the assumptions are a bit different, I'll probably have questions on that later. Aside about ng-conf: Yeah, ng-conf was nice. There was a lot of discussion about forms. It seems like all of the attempts to integrate forms with signals, a mix of template and reactive forms like this library, is what it sounds like to me that some people are speculating is the future. That's what I got from random chatter and gossip, and probably a lot of my bias in interpreting it. One of my favorite questions from the Q&A was about the future of forms. It sounds like the more immediate plan is to "bolt on" signals to the existing API, and then the future of the forms API is quite up for discussion and under wraps until then. |
We should support an API to update/set/patch the current value and/or controls of a form.
This is already supported for form fields, but not for form groups.
The text was updated successfully, but these errors were encountered: