0

It might be easier than I imagine but I found it hard to get an answer googling..

i want to create a dumb component that gets an HTML element (actually another Component) as an @Input -or some other way- to be able to ngFor on.

If I was to write it down it'll look something like:

Parent component's HTML:

<dumb-comp [element]="<some-comp></some-comp>" [values]="collection"></dumb-comp>

Dumb component's HTML:

<"element" *ngFor="let value of values;let i = index"></"element">

I know i could pass a TemplateRef as an Input and refer to it with attributes of Components like ng-bootstrap Tooltip, but i cant seem to figure out how to use that in my case.

Please let me know if I could make my question any clearer and thanks in advance

Kesem David
  • 2,135
  • 3
  • 27
  • 46
  • Sounds like http://stackoverflow.com/questions/36325212/angular-2-dynamic-tabs-with-user-click-chosen-components/36325468#36325468 – Günter Zöchbauer Nov 20 '16 at 20:47
  • @GünterZöchbauer Thanks for your quick reply Gunter, I must say I'm just a rookie with angular, and it seems like a complicated solution (Was trying to understand it for the past 15 mins and barely got it), maybe we could have a quick chat so i could explain my concrete case? – Kesem David Nov 20 '16 at 21:11
  • There are different options. You can pass a template that contains a component and use it with `ngForTemplate` or ` – Günter Zöchbauer Nov 21 '16 at 05:34

0 Answers0