valor-software / ngx-bootstrap

Fast and reliable Bootstrap widgets in Angular (supports Ivy engine)
https://valor-software.com/ngx-bootstrap
MIT License
5.53k stars 1.69k forks source link

ng2-bootstrap tab select event fire multiple time #2005

Closed bschauhan closed 7 years ago

bschauhan commented 7 years ago

i am use ng2-bootstrap tabs in our project. But, tab select event call multiple time. How to resolve it?

HTML Code:

<tabset [justified]="true" #staticTabs>
    <tab (select)="changeTab('teamtab',$event)" [active]="isCurrentTab == 'teamtab'">
        <!-- More Code -->
    </tab>
    <tab (select)="changeTab('formtab',$event)" [active]="isCurrentTab == 'formtab'">
        <!-- More Code -->
    </tab>
</tabset>

Component code:

changeTab(type, e){
    console.log(e);
}
akmittal commented 7 years ago

It is duplicate of #1820 and #1129

akmittal commented 7 years ago

Plunker to replicate issue

Workaround

changeTab(type, e){
   if (!e.tabset) return;
    console.log(e);
}
dave0688 commented 6 years ago

I think I found an edge case here:

It still fires multiple requests for me in the following scenario: I have a form in each tab. When an input is focused, and I jump into the next input with tab (AND that input where I jumped in is NOT empty), then it fires the event three times.

The workaround works for me. Still would be nice if someone could fix that.

Thanks :)