Skip to content

Commit

Permalink
fix(tabs): fix an invoke of select event outside of tabs (#3755)
Browse files Browse the repository at this point in the history
  • Loading branch information
Liudmila committed Jan 11, 2019
1 parent ac55b08 commit 106edea
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<pre class="card card-block card-header" *ngIf="value">Event select is fired. The heading of the selected tab is: {{value}}</pre>
</div>
<tabset>
<tab heading="First tab" class="mt-2" (select)="onSelect($event)">
<tab heading="First tab" class="mt-2" (selectTab)="onSelect($event)">
<h4>Title</h4>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
</tab>
<tab heading="Second tab" class="mt-2" (select)="onSelect($event)">
<tab heading="Second tab" class="mt-2" (selectTab)="onSelect($event)">
<h4>Title 2</h4>
<p>It has survived not only five centuries, but also the leap into electronic typesetting,
remaining essentially unchanged. It was popularised in the 1960s with the release of
Expand Down
2 changes: 1 addition & 1 deletion demo/src/ng-api-doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2765,7 +2765,7 @@ export const ngdoc: any = {
"description": "<p>fired before tab will be removed, $event:Tab equals to instance of removed tab </p>\n"
},
{
"name": "select",
"name": "selectTab",
"description": "<p>fired when tab became active, $event:Tab equals to selected instance of Tab component </p>\n"
}
],
Expand Down
2 changes: 1 addition & 1 deletion src/spec/tabset.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const html = `
[customClass]="tab.customClass"
[active]="tab.active"
[removable]="tab.removable"
(select)="_select($event)"
(selectTab)="_select($event)"
(deselect)="_deselect($event)"
(removed)="_removed($event)"
[heading]="tab.title">{{ tab.content }}</tab>
Expand Down
4 changes: 2 additions & 2 deletions src/tabs/tab.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class TabDirective implements OnInit, OnDestroy {
}

this._active = active;
this.select.emit(this);
this.selectTab.emit(this);
this.tabset.tabs.forEach((tab: TabDirective) => {
if (tab !== this) {
tab.active = false;
Expand All @@ -75,7 +75,7 @@ export class TabDirective implements OnInit, OnDestroy {
}

/** fired when tab became active, $event:Tab equals to selected instance of Tab component */
@Output() select: EventEmitter<TabDirective> = new EventEmitter();
@Output() selectTab: EventEmitter<TabDirective> = new EventEmitter();
/** fired when tab became inactive, $event:Tab equals to deselected instance of Tab component */
@Output() deselect: EventEmitter<TabDirective> = new EventEmitter();
/** fired before tab will be removed, $event:Tab equals to instance of removed tab */
Expand Down

0 comments on commit 106edea

Please sign in to comment.