I'm having trouble loading in components dynamically.
I implemented angular's dynamic component loader the same way as desired in their docs: https://angular.io/guide/dynamic-component-loader
What I want to do is have an ng for loop for each dynamic component
<ng-container *ngFor="let rowData of TableData">
<tbody [attr.data-index]="rowIndex">
<tr click="loadComponentForIndex()">Some Data</tr>
<ng-container *ngIf="isRowShown(rowIndex)">
<ng-template dynamicallyLoadedComponent></ng-template>
<ng-container>
</tbody>
</ng-container>
The issue is that when I click on any of the table rows, only the first component is instantiated.
Current Result:
Some Data
dynamicallyLoadedComponent
Some Data
Some Data
Some Data
Some Data
Desired Result:On click of the 2nd and 6th row:
Some Data
Some Data
dynamicallyLoadedComponent
Some Data
Some Data
Some Data
Some Data
dynamicallyLoadedComponent
Some Data
Some Data
Some Data
Some Data