Current behavior:
I'm trying to fetch new data based on a global resolved value when a specific page reloads. My resolver fires fine but the activatedRoute.data doesn't receive new data from resolver.
Expected behavior:
Ideally, the data should flow back to activatedRoute.data and I should get the new resolved data when the page reloads. It works fine in a pure Angular project.
Steps to reproduce:
Create new Lazy Loaded Ionic Project with Tabs template.
Head over to tab1 and add a new button which on click performs:
this.router.navigate([], {relativeTo: this.activatedRoute});
Set up a subscription in the page to the latest data from the activatedRoute.data stream.
this.activatedRoute.data.subscribe(val => {console.log(val)});
Related code:
Set onSameUrlNavigation: 'reload' config in RouterModule.forRoot() method.
Add a resolver to Tab1 which resolves with an array with a random value.
resolve() {
return of([Math.random()]);
}
In Tab1Module route variable, add
resolve {data: Tab1Resolver}, runGuardsAndResolvers: 'always'
Here's a minimal Ionic Tabs starter template with the essential code where this issue can be observed.
github
Here's a Stackblitz working reproduction of a pure Angular application. Product Details Page
Please let me know if I can provide more information to get this issue sorted.
Current Ionic Info
Ionic:
ionic (Ionic CLI) : 4.10.3 (/Users/myUser/.nvm/versions/node/v10.15.0/lib/node_modules/ionic) Ionic Framework : @ionic/angular 4.1.2 @angular-devkit/build-angular : 0.13.6 @angular-devkit/schematics : 7.2.4 @angular/cli : 7.3.6 @ionic/angular-toolkit : 1.4.1
System:
NodeJS : v10.15.0 (/Users/myUser/.nvm/versions/node/v10.15.0/bin/node) npm : 6.4.1 OS : macOS Mojave
Current behavior: I'm trying to fetch new data based on a global resolved value when a specific page reloads. My resolver fires fine but the activatedRoute.data doesn't receive new data from resolver.
Expected behavior: Ideally, the data should flow back to activatedRoute.data and I should get the new resolved data when the page reloads. It works fine in a pure Angular project.
Steps to reproduce:
this.router.navigate([], {relativeTo: this.activatedRoute});
this.activatedRoute.data.subscribe(val => {console.log(val)});
Related code: Set
onSameUrlNavigation: 'reload'
config inRouterModule.forRoot()
method. Add a resolver to Tab1 which resolves with an array with a random value.In Tab1Module route variable, add
resolve {data: Tab1Resolver}, runGuardsAndResolvers: 'always'
Here's a minimal Ionic Tabs starter template with the essential code where this issue can be observed. github
Here's a Stackblitz working reproduction of a pure Angular application. Product Details Page
Please let me know if I can provide more information to get this issue sorted.