Skip to content

Commit

Permalink
fix(super-tab): make sure we always have rootNavParams
Browse files Browse the repository at this point in the history
fixes #126
  • Loading branch information
ihadeed committed Jan 25, 2018
1 parent ca62985 commit 192986d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/components/super-tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,21 @@ export class SuperTab extends NavControllerBase implements OnInit, AfterViewInit
*/
@Input() root: any;

private _rootParams: any;
rootNavCtrl: NavControllerBase;

/**
* @input {object} Any nav-params to pass to the root page of this tab.
*/
@Input() rootParams: any;
@Input()
set rootParams(params: any) {
params.rootNavCtrl = this.rootNavCtrl;
this._rootParams = params;
}

get rootParams(): any {
return this._rootParams;
}

@Input('id')
tabId: string;
Expand Down
2 changes: 1 addition & 1 deletion src/components/super-tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,8 @@ export class SuperTabs implements OnInit, AfterContentInit, AfterViewInit, OnDes
}

addTab(tab: SuperTab) {
tab.rootNavCtrl = this.parent;
tab.rootParams = tab.rootParams || {};
tab.rootParams.rootNavCtrl = this.parent;

tab.tabId = tab.tabId || `super-tabs-${this.id}-tab-${this._tabs.length}`;

Expand Down

0 comments on commit 192986d

Please sign in to comment.