1

I know that in angular 2 we can create dynamic component using ComponentFactoryResolver. Here is my source http://blog.thecodecampus.de/angular-2-dynamically-render-components/. We have to mark placement of new component with #placement

But I want to place it inside *ngFor In fact it is components with operations for table row:

<tr *ngFor="let item of data">
    <td>
        <div #operations></div>
    </td>
</tr>

I have two problems with it.

  1. Angular populates only first #operations
  2. How to pass argument (row index) to new component?
piernik
  • 3,507
  • 3
  • 42
  • 84
  • 1
    You can use a wrapper element like demonstrated in http://stackoverflow.com/questions/36325212/angular-2-dynamic-tabs-with-user-click-chosen-components/36325468#36325468 – Günter Zöchbauer Nov 02 '16 at 11:15

0 Answers0