`
})
export class SmallTabsComponent implements AfterContentInit {
@ViewChild('drop_element') dropElement: ElementRef;
@ContentChildren(TabComponent) tabs: QueryList;
@Output() public selectedActiveTab: EventEmitter = new EventEmitter();
public activeTab: TabComponent = null;
// contentChildren are set
ngAfterContentInit() {
// if there is no active tab set, activate the first
if(this.tabs && this.tabs.length > 0) {
this.selectTab(this.tabs.first);
}
}
selectTab(tab: TabComponent){
this.activeTab = tab;
// activate the tab the user has clicked on.
this.selectedActiveTab.emit(tab.tabId);
if(typeof document !== 'undefined' && this.dropElement) {
UIkit.drop(this.dropElement.nativeElement).hide(false);
}
}
}