Angular 2 passing html to ng-content with bindings

前端 未结 3 875
悲哀的现实
悲哀的现实 2020-12-08 10:41

I\'m writing angular components for the foundation css framework. I am working on the tabs component, and want to be able to pass some HTML to the

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-08 11:04

    update Angular 5

    ngOutletContext was renamed to ngTemplateOutletContext

    See also https://github.com/angular/angular/blob/master/CHANGELOG.md#500-beta5-2017-08-29

    original

    ngTemplateOutlet or ngForTemplate can be used for that use case:

    
      
        
    Age
    {{item.age}}
    `
    @Component({
      ...
      template: `
        
        
    ` }) class TabsComponent { @ContentChild(TemplateRef) templateRef:TemplateRef; }

    See also Angular 2 bind transcluded content to loop variable

提交回复
热议问题