Ionic 5 router direction

Hi

I’m using Ionic 5 and router navigation from the controller as it’s even driven so can’t be on a routerLink.

this.router.navigate(['/user-profile']);

I can’t find any references to how I make the page move from right to left rather than then default left to right as I believe was possible with routerDirection in earlier versions of Ionic.

Does anyone know how to specify the direction the page swipes when navigating like this please?

Thanks!

3 Likes

Same problem here. I try to set routerDirection on ion-button with click handler, no success til now. :confused:

Same here. Is there really no anwser to this simple problem?

Ok, I think navController should be used:

import { NavController } from '@ionic/angular';
this.navController.navigateForward("/whereever")

But it`s the ionic 3 docs. Its still unclear, if navcontroller should still be used in Ionic 5

Here is a related stackoverflow entry: https://stackoverflow.com/questions/54031223/ionic-4-how-to-set-navigation-direction-backward-forward-using-routerlink

Some people say, it should not be used anymore. So the question is still: How to go forward / backward in code (not template).