I am having a problem with filter synchronization. I'm subscribeup to queryParamsof ActivatedRoute. There I get the criteria queryand my three filters.
ngOnInit() {
this.route
.queryParams
.subscribe(queryParams => {
this._query = queryParams['query'];
this._heightFilter = queryParams['height'];
this._colourFilter = queryParams['colour'];
this._weightFilter = queryParams['weight'];
});
}
When I click on the filter, let's say colour:blueI call mine reloadPage()and issue a new one queryParamsand go to the same page only with the new one queryParams.
private reloadPage(): void {
const queryParams: NavigationExtras = {};
queryParams['query'] = this._query;
this.prepareFiltersForParams(queryParams);
this.router.navigate([], {
queryParams,
});
Everything works perfectly. Now we have chosen colour:blue, but I also want colour:orange. I will be added to queryParams['colour'], which then contains blueand orange. But for some reason orangeit is not added to the url, even it goes to queryParams['colour']. If we now add a filter of another criterion, let's say heighteverything will be fine and smooth, and the filter heightwill be added as well colour:orange.
, change detection this.route.queryParams.subscribe queryParams['colour'] .
GH angular # 17609.