Hello masters. 
I need a manually compile HTML template for angular 2 directive.
Thanks in advance.

Code example:

@Directive({ selector: '[layout]' }) 
export class Layout { 
  constructor( private templateRef: TemplateRef, private viewContainer: 
ViewContainerRef){ } 
  @Input() set layout(value) { 
    if (value) { 
      // Only for example 
      var div = document.createElement('div'); 
      div.innerHTML = '<header>This is {{value}} header</header>'; 
      // ??? How to put the div element to the View 

      var embeddedViewRef = 
this.viewContainer.createEmbeddedView(this.templateRef); 
    } else { 
      this.viewContainer.clear(); 
    } 
  } 
}

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to