import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core'; @Directive({ selector: '[ngTransclude]' }) export class NgTranscludeDirective { public viewRef:ViewContainerRef; protected _viewRef:ViewContainerRef; protected _ngTransclude:TemplateRef; @Input() public set ngTransclude(templateRef:TemplateRef) { this._ngTransclude = templateRef; if (templateRef) { this.viewRef.createEmbeddedView(templateRef); } } public get ngTransclude():TemplateRef { return this._ngTransclude; } public constructor(viewRef:ViewContainerRef) { this.viewRef = viewRef; } }