I have an ngFor loop in one of my Angular templates that includes another component, here's a snippet:
<div *ngFor="let thing of things" (click)="onClick($event, thing)"> <app-thing [data]="thing"></app-thing> </div> and Angular is wrapping each app-thing with a div containing an attribute called _ngcontent_c4 as follows:
<div _ngcontent_c4> <app-thing...> <!-- ... --> </app-thing> </div> <div _ngcontent_c4> <app-thing...> <!-- ... --> </app-thing> </div> <div _ngcontent_c4> <app-thing...> <!-- ... --> </app-thing> </div> <!-- ... ---> The parent div wrapper is causing issues, especially with styling, and making it harder to use the :host selector to style the component itself. I had to move some styling outside the :host to target the parent to get my flexbox layout working properly.
Is there a way to get Angular not to wrap components?