diff --git a/src/components/tabs/tabs.ts b/src/components/tabs/tabs.ts index a94768eef93..75d082a4099 100644 --- a/src/components/tabs/tabs.ts +++ b/src/components/tabs/tabs.ts @@ -529,12 +529,16 @@ export class Tabs extends Ion implements AfterViewInit { } else if (tab.length() > 1) { // if we're a few pages deep, pop to root - tab.popToRoot(); + tab.popToRoot().catch(() => { + console.debug('Tabs: pop to root was cancelled'); + }); } else if (getComponent(this._linker, tab.root) !== active.component) { // Otherwise, if the page we're on is not our real root, reset it to our // default root type - tab.setRoot(tab.root); + tab.setRoot(tab.root).catch(() => { + console.debug('Tabs: reset root was cancelled'); + }); } } } @@ -545,7 +549,7 @@ export class Tabs extends Ion implements AfterViewInit { */ setTabbarPosition(top: number, bottom: number) { if (this._top !== top || this._bottom !== bottom) { - const tabbarEle = this._tabbar.nativeElement; + var tabbarEle = this._tabbar.nativeElement; tabbarEle.style.top = (top > -1 ? top + 'px' : ''); tabbarEle.style.bottom = (bottom > -1 ? bottom + 'px' : ''); tabbarEle.classList.add('show-tabbar'); diff --git a/src/components/tabs/test/advanced/app.module.ts b/src/components/tabs/test/advanced/app.module.ts index 0efa801b5d7..5168eb678fc 100644 --- a/src/components/tabs/test/advanced/app.module.ts +++ b/src/components/tabs/test/advanced/app.module.ts @@ -315,6 +315,11 @@ export class Tab2Page3 { constructor(public navCtrl: NavController) {} + ionViewCanLeave() { + console.log('Tab2Page3, ionViewCanLeave', false); + return false; + } + ionViewWillEnter() { console.log('Tab2Page3, ionViewWillEnter'); } diff --git a/src/components/tabs/test/advanced/tab2page3.html b/src/components/tabs/test/advanced/tab2page3.html index 42abbfe97a3..657a2079732 100644 --- a/src/components/tabs/test/advanced/tab2page3.html +++ b/src/components/tabs/test/advanced/tab2page3.html @@ -4,8 +4,9 @@

Tab 2, Page 3

No Header.

+

This page can't be left

-

+