import { Directive , TemplateRef , ContentChild , AfterContentInit } from '@angular/core' ; import { NglTab } from './tab' ; @ Directive ( { selector : '[ngl-tab-label]' } ) export class NglTabLabel { constructor ( public templateRef ) { } } @ Directive ( { selector : '[ngl-tab-content]' } ) export class NglTabContent { constructor ( public templateRef ) { } } @ Directive ( { selector : 'ngl-tab' , providers : [ { provide : NglTab , useExisting : NglTabVerbose } ] , } ) export class NglTabVerbose extends NglTab implements AfterContentInit { @ ContentChild ( NglTabContent ) contentTemplate : NglTabContent ; @ ContentChild ( NglTabLabel ) labelTemplate : NglTabLabel ; ngAfterContentInit ( ) { if ( this . labelTemplate ) { this . label = this . labelTemplate . templateRef ; } this . templateRef = this . contentTemplate . templateRef ; } }