/**
* The main component that renders single TabComponent
* instances.
*/
import {AfterContentInit, Component, ContentChildren, EventEmitter, Input, Output, QueryList,} from '@angular/core';
import {TabComponent} from './tab.component';
@Component({
selector: 'my-tabs',
template: `
`
})
export class TabsComponent implements AfterContentInit {
@Input()
public customClass: string;
@ContentChildren(TabComponent) tabs: QueryList;
@Output() public selectedActiveTab: EventEmitter = new EventEmitter();
public selected: string;
ngAfterContentInit() {
if(this.tabs.length > 0) {
this.selected = this.tabs.get(0).tabId;
}
}
selectTab(tab: TabComponent){
this.selected = tab.tabId;
this.selectedActiveTab.emit(tab.tabId);
}
}