Component transclude with inline template

后端 未结 2 1764
萌比男神i
萌比男神i 2021-01-05 07:50

I\'m using Angular 2-rc3 and have a Component and I want to apply transclusion, just in a bit of a different way. Here\'s my component:

import {         


        
2条回答
  •  一生所求
    2021-01-05 08:30

    • inside *ngFor doesn't work, therefore

    • -- insert template here --

    won't do anything meaningful. Everything will be transcluded to the first

    https://github.com/angular/angular/issues/8563 might solve some of your requirements.

    • Binding events when using a ngForTemplate in Angular 2
    • ng-content select bound variable might be an approach that would allow to do something similar like you demonstrated in your question.
      It requires the user of your component to wrap the content in a