bug: How to navigate forward to same page with animation
See original GitHub issueI’m migrating ionic 3 app to ionic 4. In old app we have complex component what we use with navCtr.push multiple times, with different data. Because those components have related details, we can really go deep on the nav stack. So we have the same compontent into the nav stack multiple times. In the new ionic 4 I have one tabs child route for this. But when I’m navigating into the same page with different url params the animation not working. Is it possible to animate even if we navigating forward to the same page? Another possibe bug, when I’m on the serach tab, and trying to animate forward to the /tabs/home/component ,this is also the same component what I mentioned before, the animation is not working. It’s just displaying the correct tabs/home/childcompoennet but no animation. If I create child component to the search tab with the same component than the animation is working. Is this the correct way to create multipliple router endpoints under several tabs just to be abble to navigate forward with animation? I really need to find soultion for this, otherwise we cannot migrate our application.
Thanks for the help.
`Ionic:
ionic (Ionic CLI) : 4.10.1 Ionic Framework : @ionic/angular 4.4.0 @angular-devkit/build-angular : 0.13.9 @angular-devkit/schematics : 7.3.9 @angular/cli : 7.3.9 @ionic/angular-toolkit : 1.5.1
System:
NodeJS : v10.15.1 (C:\Program Files\nodejs\node.exe) npm : 6.4.1 OS : Windows 10 `
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (1 by maintainers)
I didn’t. To display animation yes we can create 2 different routes, and than load the same page once into the route 1 and next time to route 2. But thats ugly solution in our case because we can go to that route from multiple tabs. So i need to create that 2 extra route for each tabs, to show the navigation animation properly. And we push multiple times that component in ionic 3 its works fine with nav push, but I dont know how to do it with ionic 4. Also we subscrabing to the ngrx store each time on that component. And cannot subscribe on onNgDestroy and on ionViewWillLeave. So if I visiting third time that page than the 3 subscription happens, which not good. Currently I’m migration the rest of the app, and I going to try this later again.
By default, the router ignores navigation requests to the current URL. In your app-routing module, set
onSameUrlNavigation: 'reload'
, which should look like:Alternatively you could abstract the content of your page into a
component
, and put the component into two different pages that have routes to each other, as I don’t believe the above solution will animate.