/** * The main component that renders single TabComponent * instances. */ import { Component, ContentChildren, QueryList, AfterContentInit, Output, EventEmitter, } from '@angular/core'; import { TabComponent } from './tab.component'; @Component({ selector: 'my-tabs', template: `
` }) export class TabsComponent { @ContentChildren(TabComponent) tabs: QueryList; @Output() public selectedActiveTab: EventEmitter = new EventEmitter(); selectTab(tab: TabComponent){ // activate the tab the user has clicked on. this.selectedActiveTab.emit(tab.tabId); } }