Open alcaidio opened 4 months ago
Hi, I tried to do something like this, automatic synchronization of queryParams, but the issues is: There are cases where we want to keep some queryParams, and cases when we want to merge, or remove or do a lot of other things, and that's why navigate method of the router includes a lot of other keys in there that we would need to support or duplicate.
That's why there's nothing in ngxtension that simplifies this.
It's a pity, because I think that for simple and common cases as described above it would have been practical, but I note that it's not generic enough to be included in this repo ;)
I have a feature proposal that I'd like to discuss with you all.
The idea is to create a utility to bind our application state with our router, particularly focusing on query parameters. This would enable synchronization, for instance, of filters with the route of an e-commerce site.
Consider the following interfaces:
The route could then take the form:
https://example.com/products?brand=nike,adidas&category=shoes&price-min=30&price-max=90
What we aim for is to bind to our route declaratively without dealing with the activatedRoute.params observable directly. For example:
Here's a proposed implementation for bindWithRouter, which would facilitate developing the feature (to be made generic with strict typing, of course):
This discussion aims to explore whether there is a real need for this feature and to collaboratively define its scope and specifications. After reaching consensus during this initial phase (if there is a need), I'm eager to take the next step and bring this feature to life, realizing my aspiration to contribute meaningfully to the Angular ecosystem. 🤩
Your thoughts and suggestions on this proposal would be highly appreciated!