diff --git a/projects/kit/components/tabs/tabs-with-more/tabs-with-more.component.ts b/projects/kit/components/tabs/tabs-with-more/tabs-with-more.component.ts index c670570f8e54..b994f1d0a4aa 100644 --- a/projects/kit/components/tabs/tabs-with-more/tabs-with-more.component.ts +++ b/projects/kit/components/tabs/tabs-with-more/tabs-with-more.component.ts @@ -58,8 +58,11 @@ export class TuiTabsWithMoreComponent implements AfterViewInit { @HostBinding('class._underline') underline = this.options.underline; - @Input() - activeItemIndex = 0; + @Input('activeItemIndex') + set itemIndex(activeItemIndex: number) { + this.activeItemIndex = activeItemIndex; + this.maxIndex = this.getMaxIndex(); + } @Input() itemsLimit = this.options.itemsLimit; @@ -70,6 +73,8 @@ export class TuiTabsWithMoreComponent implements AfterViewInit { @ContentChildren(TuiItemDirective, {read: TemplateRef}) readonly items: QueryList>> = EMPTY_QUERY; + activeItemIndex = 0; + open = false; constructor( @@ -236,8 +241,7 @@ export class TuiTabsWithMoreComponent implements AfterViewInit { } private updateActiveItemIndex(activeItemIndex: number): void { - this.activeItemIndex = activeItemIndex; + this.itemIndex = activeItemIndex; this.activeItemIndexChange.emit(activeItemIndex); - this.maxIndex = this.getMaxIndex(); } }