Comments (4)
Is there a way to add QueryFormGroups in existing QueryFormGroups and still to make it work?
QueryParamGroup
does not support nesting groups into each other, because ultimately that doesn't make sense: the URL is one flat object.
I can't get it how to force my addControlToForm to use QueryParamGroup instead of regular FormGroup
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.
from ngqp.
Okay, got it.
So if I'd like to make a filtering with query params syncing there is no easy way to make that work out of the box, isn't there?
I mean in the context where filtering has some groups of options (which are represented as checbox
es) and each group has to be synced with URL depending on controls' values like:
?group1=option1,option2,option3&group2=option2
and so on.
from ngqp.
So if I'd like to make a filtering with query params syncing
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.
from ngqp.
Your example is exactly that I needed.
I've implemented some workarounds around FormGroup to make the filtration either, so from now I have two different ways to solve the problem.
Thank you and get well!
from ngqp.
Related Issues (20)
- Partition URL parameters HOT 6
- Programmatically set value of parameters inside a partition
- emptyOn + multi leads to incorrect behavior HOT 1
- Provide the entire array to (de-)serializers for multi params
- Combination of `multi` and normal parameter breaks `valueChanges` HOT 4
- Switch multi property HOT 6
- Need Ivy support HOT 5
- valueChanges Observable from one param is leaking Events from other params of the same group. HOT 6
- Synchronize router based on manual trigger HOT 2
- Programmatically delete/remove/reset queryForms and queryParams HOT 7
- How to have custom values in select dropdowns? HOT 9
- No chance to access first value of paramGroup on component load HOT 3
- Expose a replayed value$ observable HOT 2
- Update version support on website
- Update to support Angular 13 HOT 2
- 'QueryParamModule' does not appear to be an NgModule class HOT 4
- Proper support of angular 14+ (Not working in angular 16 due to absent ngcc) HOT 7
- Types of property 'serialize' are incompatible HOT 2
- Angular 16 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngqp.