diff --git a/src/components/super-tabs/super-tabs.ts b/src/components/super-tabs/super-tabs.ts index 4056ba7..35f4008 100644 --- a/src/components/super-tabs/super-tabs.ts +++ b/src/components/super-tabs/super-tabs.ts @@ -426,6 +426,11 @@ export class SuperTabs implements OnInit, AfterContentInit, AfterViewInit, OnDes */ onTabChange(index: number) { if (index <= this._tabs.length) { + const currentTab: SuperTab = this.getActiveTab(); + let activeView: ViewController = currentTab.getActive(); + + activeView._willLeave(false); + activeView._didLeave(); this.selectedTabIndex = index; @@ -433,6 +438,13 @@ export class SuperTabs implements OnInit, AfterContentInit, AfterViewInit, OnDes this.refreshTabStates(); + activeView = this.getActiveTab().getActive(); + + if (activeView) { + activeView._willEnter(); + activeView._didEnter(); + } + this.tabSelect.emit({ index, id: this._tabs[index].tabId @@ -566,6 +578,10 @@ export class SuperTabs implements OnInit, AfterContentInit, AfterViewInit, OnDes return this._tabs.find((tab: SuperTab) => tab.tabId === tabId); } + getActiveTab(): SuperTab { + return this._tabs[this.selectedTabIndex]; + } + getElementRef() { return this.el; } initPane() { return true; }