Hi all,
I’ve been learning ionic2 by going over the ionic conference app code. I am wondering why the back button does not show up in cases where you might expect.
For example the login page pushes a view on login:
if (form.valid) {
this.userData.login(this.login.username);
this.navCtrl.push(TabsPage);
}
I added some code to the tabs page to expose the NavController and App:
tabs.ts
ionViewDidLoad() {
console.log("Tab page canGoBack = ", this.navCtrl.canGoBack());
// Returns the current stack of views in this nav controller.
var viewArray = this.navCtrl.getViews();
viewArray.forEach( function( view, i) {
console.log("View index ",i,":",view.component)
});
console.log("Root Nav:", this.appCtrl.getRootNav());
}
So after you login and get to the tabs page, Here is the console output
Tab page canGoBack = true
tabs.ts:39 View index 0 : function LoginPage(navCtrl, userData) {
this.navCtrl = navCtrl;
this.userData = userData;
this.login = {};
this.submitted = false;
}
tabs.ts:39 View index 1 : function TabsPage(navParams, navCtrl, appCtrl) {
this.navCtrl = navCtrl;
this.appCtrl = appCtrl;
// set the root pages for each tab
this.tab1Root = __WEBPACK_IMPORT…
So with the view stack like this I’m wondering why there’s no back button on the Tabs page in this case…
Thanks