@arturalkaim When you say that it work in some pages, are those pages shown via NavController.push? and
the ones that don’t work via NavController.setRoot?
.
This happened in my case, because it seems that in child pages of tabs the setRoot
define the page as root relative to the ion-tabs
, not to the ion-nav
, as I intended.
To solve that, I created a custom service named NavService
that just have methods to set and get a NavController
. Then, in my NavPage
component (that has an ion-nav
html tag) I set the NavController
related to its ion-nav
in the service. Finally, I inject the service in other pages and use the service NavController, instead of its own.
In NavPage
:
@ViewChild('content') contentNavCtrl: NavController;
…
ngOnInit() {
this.navService.setRootNav(this.contentNavCtrl);
//...
}
In other pages (when I want to set a root page), and even in the NavPage
too:
this.navService.getRootNav().setRoot(SomePage)
I also do push
and pop
this way, because it seems that pop
in a page with tabs directly in the component NavController
don’t work.
I don’t know if this is your case, but I solved my issue with tabs (both setRoot() and pop()) this way, using my custom service in all pages, instead of injecting the NavController
in the constructor and using it.