/** Allows us to pass in a template (i.e.: the shortcut of *) and created it in via embedded view: **/ import { Directive , TemplateRef , ViewContainerRef , Input } from '@angular/core' ; @ Directive ( { selector : '[directiveWithTemp]' } ) export class DirectiveWithTemp { constructor ( private templateRef , private viewContainer ) { } @ Input ( ) set appMydirective ( user ) { if ( user . status == 'active' ) { this . viewContainer . createEmbeddedView ( this . templateRef ) ; } } }