Since upgrading to Beta 11 the following code no longer works…
this.navController.rootNav.setRoot( MyPage )
I am getting the following error…
Property 'rootNav' does not exist on type 'NavController'.
I have been using the root navigation controller to get outside the navigation stack of tabs. As far as i know, I don’t have access to the root nav through ViewChild as I am outside the scope of my main app file at this point.
Was this intended with the upgrade to Beta 11? If so moving forward what would be the recommended method of accessing the root nav?
I have the same problem… But I dont know where can i get this.app when I import MyApp it says: Property 'getRootNav' does not exist on type 'MyApp'.
Can you help me, please?
I think it is a major mistake to try to access anything involving the view layer (including navigation) from inside service providers. Providers should provide data, and have absolutely no concept or concern with how it is displayed.
What I do is to simply modify the rootPage property of the app component, and let Ionic do the rest. For example, I frequently have an authentication provider service, that is responsible for interacting with storage and authentication servers. It exposes an Observable<boolean> (that is internally a ReplaySubject with a stack depth of 1). In the app’s constructor, I do something like this:
This gives you logout functionality for virtually free. Anybody can inject the provider of the authentication notifier, call logout on it, which internally calls authenticationNotifier.next(false) and you don’t have to worry about futzing with navigation.