How do I pass an ngFor variable to the ng-content template.
Example, the containing-component:
-
You can not use ng-content as dynamic template. Use ng-template instead
-
export class ContainingComponent {
...
@ContentChild(TemplateRef, {static: true})
@Input() itemTemplate: TemplateRef;
}
So you can reference dynamic template into containing-component. In this case, you can wrap ng-template over content-component
Or use ng-template directly: