[ADF-1574] Info Drawer - Add a mechanism to know the current active tab (#2352)

* [ADF-1574] Info Drawer - Add a mechanism to know the current active tab

* Added a output event in adf-info-drawer component to get the currently active tab

* [ADF-1574] Info Drawer - Add a mechanism to know the current active tab

* Added a output event in adf-info-drawer component to get the currently active tab

* Added unit test file

* Updated info-drawer.md
This commit is contained in:
madhukar23
2017-09-21 13:53:47 +05:30
committed by Maurizio Vitale
parent a3020897ed
commit c8743dacc6
4 changed files with 85 additions and 5 deletions

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, ContentChildren, Input, QueryList, TemplateRef, ViewChild, ViewEncapsulation } from '@angular/core';
import { Component, ContentChildren, EventEmitter, Input, Output, QueryList, TemplateRef, ViewChild, ViewEncapsulation } from '@angular/core';
@Component({
selector: 'adf-info-drawer-tab',
template: '<ng-template><ng-content></ng-content></ng-template>'
@@ -36,10 +36,18 @@ export class InfoDrawerComponent {
@Input()
title: string|null = null;
@Output()
currentTab: EventEmitter<any> = new EventEmitter<any>();
@ContentChildren(InfoDrawerTabComponent)
contentBlocks: QueryList<InfoDrawerTabComponent>;
showTabLayout(): boolean {
return this.contentBlocks.length > 0;
}
onTabChange(event: any) {
const tab = event.tab;
this.currentTab.emit(tab.textLabel);
}
}