ionic-framework: [4.0.0-rc.3] Back button not working with tabs
Bug Report
Ionic version: 4.0.0-rc.3
Current behavior: In the new RC, upon clicking the hardware back button in a tab, it does not go to the previous tab as before
Expected behavior: It should either go to home tab, or to previous tab
Steps to reproduce: See behavior.
Related code:
Other information:
Ionic info:
insert the output from ionic info here
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (7 by maintainers)
NavController in V4 is just a thin wrapper on top of Angular Router, it does not replace it. It is just useful when you want a fine control over the animations (transitions) and stack.
Stack, you can go forward and backward, pushing or popping pages from the DOM. How do you control it? Using the angular router.
BUT if you want fine control, NavController exposes additional APIs for you to control it.
Tabs is a good use case, take a iOS native app, imagine you navigate forward in a tab and now you switch to a different tab. The “navigation” performed in the first tab is still there when you go back, that’s what the “stack” does for you.
The stack is handled automatically by Ionic when using the Angular Router.
There is a confusion between v3 NavController and v4 NavController:
<ion-nav>Source code is the best documentation: https://github.com/ionic-team/ionic/blob/master/angular/src/providers/nav-controller.ts#L183-L190
Thanks for the feedback, this helps a lot to understand what things are confusing and we can focus our efforts to improve the documentation of this parts of Ionic!
Going to close this issue, since github issues are not intended for support purposes.
I invited a member of the official Ionic team to this topic, he will tell you more information about it 😃
Is there some way to go back without popping or using NavController but instead with Angular Router?. NavController is not going to be deprecated?.
Thanks!
@mhartington Could you please give examples where I should use each?