Using ionic 4 with angular router, when the following provider is used in app.module.ts:
providers: [
...
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
...
],
the ActivatedRoute queryParams observable will only fire once:
constructor(
...
private route: ActivatedRoute,
...
}
ngOnInit() {
this.route
.queryParams
.subscribe((params: Params) => {
// where reach here only once
console.log('HomePage::queryParams', params);
});
}
However, the ActivatedRoute events observable will fire every time:
this.router
.events
.pipe(filter(event => event instanceof NavigationEnd))
.subscribe(event => {
// will reach here
console.log('NavigationEnd', event);
});
Has anyone resolved this before?
Could be related to:
Subscribing to route params is not working #16581