ionic-team / ionic-team/ionic-framework

'onSameUrlNavigation' config doesn't work in v4.

Abierto
#17,867 3 comentarios 5 reacciones 0 asignados Ver en GitHub
package: angular type: bug
Lenguaje dominante
TypeScript
Estrellas
52.7k
Forks
13.3k
Merge medio
1 d 15 h
PR fusionados (30 d)
51

Descripción

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:**

1. Create new Lazy Loaded Ionic Project with Tabs template.
2. Head over to tab1 and add a new button which on click performs:
`this.router.navigate([], {relativeTo: this.activatedRoute});`
3. 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](https://github.com/anjildhamala/ionic-starter-template)

Here's a [Stackblitz](https://stackblitz.com/edit/angular6-lazy-loading-l7rd9v) 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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.