Displaying component dynamically by index inside ngFor
Update your code to have the *ngIf
dependent on the index: *ngIf="showCommentComponent[i]"
<app-today-tasks-comments id="{{'tasksComment' + i}}" *ngIf="showCommentComponent[i]"></app-today-tasks-comments>
And then in your class, toggle that index on a map:
showCommentComponent = {};
displayCommentsComponent(index){
this.showCommentComponent[index] = !this.showCommentComponent[index];
}