Code Monkey home page Code Monkey logo

Comments (4)

Airblader avatar Airblader commented on June 21, 2024

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.

verfault avatar verfault commented on June 21, 2024

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 checboxes) 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.

Airblader avatar Airblader commented on June 21, 2024

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.

verfault avatar verfault commented on June 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.