-
Notifications
You must be signed in to change notification settings - Fork 8
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
Sync URL with nested QueryParamGroup #180
Comments
This isn't possible. ngqp models its API after Angular Forms, but they are in no way "interchangeable". In fact, using both an Angular form and ngqp is not really what ngqp was originally intended to be used for (you either want to synchronize to the URL as you type, or have a submit-able form, but not both). See Limitations as well. It is possible to combine Angular forms and ngqp, though. Unfortunately due to how Angular works there is no really good, smooth way to make that work out of the box. You essentially need to manually hook up the QueryParamGroup and FormGroup and synchronize between the two. |
Okay, got it. I mean in the context where filtering has some groups of options (which are represented as
|
That is essentially exactly what ngqp was designed for – if you want to do this as the user interacts with the form, not only once they submit the form (as is the case with Amazon). For the latter, most of what ngqp does isn't necessary. However, I do understand that ngqp might still provide enough "comfort" that you'd want to be able to use it nonetheless. I go into a bit more detail on that in my response in #165, which I seem to have forgotten about during my illness. You can see there my thought that a likely way I'd implement this in ngqp is by allowing to turn off the automatic synchronization and provide a trigger instead which you'd have to call from your onSubmit handler. I also mention there a way this could potentially be achieved already now. I did quickly prototype what that would look like, you can find it here: https://stackblitz.com/edit/angular-ivy-hgjj6l? – I can't promise this works in all cases and scenarios, but you could give it a shot if you wanted to. |
Your example is exactly that I needed. Thank you and get well! |
Hello again!
Example: StackBlitz
Version of
"@ngqp/core"
: "1.0.0"Version of
"@angular/core"
: "9.1.0"Question
Could you help me with one deal:
I need to sync nested
FormGroup
s with URI by transforming it intoQueryFormGroup
s but I've no idea how to handle it properly.Is there a way to add
QueryFormGroup
s in existingQueryFormGroup
s and still to make it work?I can't get it how to force my
addControlToForm
to useQueryParamGroup
instead of regularFormGroup
Perhaps, the main things I've already explained by the code and in the code, so that would be quite difficult to explain the problem by text. So I'm sorry that I've done the description of the problem that short.
Thank you!
The text was updated successfully, but these errors were encountered: