I am migrating to Ionic4 and I have a question about the way of navigating between pages.
I am using NavController with goRoot, goForward and goBack.
Now I want to be able to set a stack of opened pages when I select a new route from a Menu. I don´t know how to use something similar to the setPages method that I was using with Ionic 3.
The NavController is gone. My suggestion is that you take a day and build an Angular-only app from your favorite Angular tutorial. The routing for that app will be the same as what you will use in Ionic 4. (Modals and popovers are still special in Ionic 4. Mostly.)
That tutorial warns you that the NavController in Ionic 4 is unstable, might be renamed, have different properties, etc. Nobody knows the answer to your question, maybe not even the devs. If you can avoid using NavController, you should. People have been writing Angular apps for years without it. My advice is still the same as it was in my previous post.
How do you indicate the “router direction” when using the Angular router? The NavController in the latest beta (as described in the article above) is basically just a wrapper around angular routing but also lets you indicate “direction” (forward, back, root) which Ionic uses to select the appropriate animation.
Since NavController isn’t in the latest docs I’m guessing it’s going to be removed but that leaves a gap in functionality. You can still indicate direction in your template
But there is no way to give that direction hint if you need to navigate programmatically.
To the original poster, the NavController.goRoot/Forward/Back are currently working for me. Are you sure you have routes defined that match? Check your browser console, is it spitting out any errors?
Angular routes is working okey for me and my routes are well defined in the corresponding routing.ts.
My problem is that when I navigate through my menu, navCtrl saves the stack of pages where I have passed. Then using the ion-back-button it goes back page by page until it arrives to my main page.
I want to navigate directly to my main page when I click the ion-back-button so I need to have always ‘main/start’ as root and then goForward the selected menuOption.