Comments (6)
Thanks for reporting an issue and providing a Stackblitz! Just to be clear, the issue you are bringing up is that when I change the second dropdown, an event emits for select1 (but still with the correct value), correct?
from ngqp.
Yes. Sorry for the short description - still playing around with some other issues I have.
distinctUntilChanged
would be the workaround.
from ngqp.
Thanks for clarifying! This does deserve a bit of background explanation. A fundamental design decision in ngqp is to make the route the single source of truth. This means that changing the dropdown writes to the URL, and ngqp listens to the URL to synchronize the model from. These are essentially two independent processes.
So in this case, changing the value updates the URL, and then because ngqp also listens for the URL, we get a navigation event and from there emit on the observables. The problem, however, is that we don't know which parameters changed with this navigation event.
Of course we could bake distinctUntilChanged into ngqp directly. But this would mean no-op value changes would not emit, which is also unexpected, and not in line with Angular forms. An even bigger reason is that with the current way the user has both options (by adding distinctUntilChanged or not), but if we bake it into ngqp we take away this option from the user.
In principle I think this is all still true, adding distinctUntilChanged is easy enough, and as such I'm incline to say this works as intended. A quick thought I just had, however, is that we could possibly pass information on which parameters have been changed in the navigation state (we already do something similar for programmatic changes).
I'll leave this issue open like this for this thought, but in the meantime I think adding distinctUntilChanged is the intended solution and not so much of a workaround. Does that work for you?
from ngqp.
Sure, just a small Note in the docs would be nice.
from ngqp.
Yes, a note in the documentation would definitely be a good idea as well. Feel free to submit a PR if you want :-)
from ngqp.
😉 I will
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
- 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
- Sync URL with nested QueryParamGroup HOT 4
- 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.