[ADF-2007] Info Drawer - currentTab event should return a key not the label (#2715)

* [ADF-2007] bug fix

Info drawer will emit the current active tab instead of the tab label
Also updated the test spec

* Emit tab index on clicking
This commit is contained in:
mihai sirghe
2017-11-25 01:55:03 +02:00
committed by Eugenio Romano
parent eba4399d6c
commit eba46e4e44
3 changed files with 8 additions and 8 deletions

View File

@@ -16,6 +16,7 @@
*/
import { Component, ContentChildren, EventEmitter, Input, Output, QueryList, TemplateRef, ViewChild, ViewEncapsulation } from '@angular/core';
import { MatTabChangeEvent } from '@angular/material';
@Component({
selector: 'adf-info-drawer-tab',
template: '<ng-template><ng-content></ng-content></ng-template>'
@@ -37,7 +38,7 @@ export class InfoDrawerComponent {
title: string|null = null;
@Output()
currentTab: EventEmitter<any> = new EventEmitter<any>();
currentTab: EventEmitter<number> = new EventEmitter<number>();
@ContentChildren(InfoDrawerTabComponent)
contentBlocks: QueryList<InfoDrawerTabComponent>;
@@ -46,8 +47,7 @@ export class InfoDrawerComponent {
return this.contentBlocks.length > 0;
}
onTabChange(event: any) {
const tab = event.tab;
this.currentTab.emit(tab.textLabel);
onTabChange(event: MatTabChangeEvent) {
this.currentTab.emit(event.index);
}
}