bug (router) routerState.queryParams.subscribe() often not triggered
See original GitHub issueI’m submitting a … (check one with “x”)
[ x ] bug report
Current behavior sometimes (or most often) changes in the queryParams wont trigger an observable event.
Expected/desired behavior all changes to the queryParams will trigger an observable event
Reproduction of the problem on an ngOnInit method i subscribe to the following events:
this.router.events.subscribe(x => {
console.log('router.events.subscribe:');
console.log(x);
});
this.routeSubscription = this.router.routerState.queryParams.subscribe(params => {
this.currentScope = params['scope'];
this.currentOrder = params['order'];
console.log('queryParams.subscribe: ${JSON.stringify(params)}');
});
and the view calls one of those functions:
{ const currentParas = this.router.routerState.snapshot.queryParams; currentParas['order'] = order; this.router.navigate(['/version/create'], { queryParams: currentParas }); }
the thing is: even if all navigate events will fired, and the browser shows the correct queryParams, the event wont triggered sometimes. it seems totaly random and i have no clue why.
What is the expected behavior?
each time i use router.navigate and append a queryParams, the routerState.queryParams observable will fire and event.
What is the motivation / use case for changing the behavior?
a simple dropdown where the user is able to select one of many filters and/or order for a list
Please tell us about your environment:
- Angular version: 2.0.0-rc.4
- Angular router: 3.0.0-beta.2
- Browser: [Chrome Version 51.0.2704.106 m (64-bit) ]
- Language: [all | TypeScript X.X | es5 ]
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Thanks. I confirmed that this a bug. In the meantime, I’d recommend using
Object.assign
to store your snapshot params.This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.