import { Directive , EmbeddedViewRef , Input , TemplateRef , ViewContainerRef } from '@angular/core' ; @ Directive ( { selector : '[uxLayoutSwitcherItem]' } ) export class LayoutSwitcherItemDirective { @ Input ( 'uxLayoutSwitcherItem' ) private _config : LayoutSwitcherItem ; private _embeddedView : EmbeddedViewRef < any > ; constructor ( private _templateRef , private _viewContainerRef ) { } getLayout ( ) { return this . _templateRef ; } getConfig ( ) { return this . _config ; } activate ( ) { this . _embeddedView = this . _viewContainerRef . createEmbeddedView ( this . _templateRef ) ; } deactivate ( ) { const index = this . _viewContainerRef . indexOf ( this . _embeddedView ) ; this . _viewContainerRef . remove ( index ) ; this . _embeddedView = null ; } } export interface LayoutSwitcherItem { group ? : string ; minWidth ? : number ; maxWidth ? : number ; }