Skip to content

Commit 07240cf

Browse files
committed
fix(super-tabs): wait for view init before setting indicator position
fixes #23
1 parent 2941ce9 commit 07240cf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/components/super-tabs/super-tabs.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export class SuperTabs implements OnInit, AfterContentInit, AfterViewInit, OnDes
118118
@Input()
119119
set selectedTabIndex(val: number) {
120120
this._selectedTabIndex = Number(val);
121-
this.alignIndicatorPosition(true);
121+
this.init && this.alignIndicatorPosition(true);
122122
}
123123

124124
get selectedTabIndex(): number {
@@ -166,6 +166,8 @@ export class SuperTabs implements OnInit, AfterContentInit, AfterViewInit, OnDes
166166

167167
private hasTitles: boolean = false;
168168

169+
private init: boolean = false;
170+
169171
parent: NavControllerBase;
170172

171173
constructor(
@@ -273,6 +275,8 @@ export class SuperTabs implements OnInit, AfterContentInit, AfterViewInit, OnDes
273275

274276
this.refreshContainerHeight();
275277

278+
this.init = true;
279+
276280
}
277281

278282
ngOnDestroy() {
@@ -492,7 +496,6 @@ export class SuperTabs implements OnInit, AfterContentInit, AfterViewInit, OnDes
492496
} else if (ip - (mw / 2 - iw / 2) < sp) {
493497

494498
// we need to move the segment container to the right
495-
496499
pos = ip - (mw / 2 - iw / 2);
497500
pos = pos >= 0 ? pos : 0;
498501

0 commit comments

Comments
 (0)