Skip to content

Commit

Permalink
fix(tabs): fix select/deselect multiple calls (#2361)
Browse files Browse the repository at this point in the history
fixes #2005
fixes #1820
fixes #1129
  • Loading branch information
IlyaSurmay authored and valorkin committed Aug 4, 2017
1 parent c0347d7 commit 5dd456b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/spec/tabset.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { TabsetComponent } from '../tabs/tabset.component';
const html = `
<tabset #tabset [justified]="isJustified"
[vertical]="isVertical">
<tab heading="tab0">tab0 content</tab>
<tab heading="tab0" (deselect)="_deselect($event)">tab0 content</tab>
<tab *ngFor="let tab of tabs"
[disabled]="tab.disabled"
[customClass]="tab.customClass"
Expand Down
7 changes: 5 additions & 2 deletions src/tabs/tab.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ export class TabDirective implements OnInit, OnDestroy {
}

public set active(active: boolean) {
if (this._active === active) {
return;
}
if (this.disabled && active || !active) {
if (!active) {
if (this._active && !active) {
this.deselect.emit(this);
this._active = active;
}

this.deselect.emit(this);
return;
}

Expand Down

0 comments on commit 5dd456b

Please sign in to comment.