Load components from an array of selectors

20 views Asked by At

I have a list of components:

public entrys: any[] = [
'<component1></component1>',
'<component2></component2>',
'<component3></component3>'
];

I want to display the components of this array.

I tried this way but it didn't work:

<div *ngFor="let entry of entrys" [innerHTML]="entry"></div>

If it's a static HTML element (p, span) it works, but if it's a component I generated from angular CLI, it doesn't display the component on the screen.

I need to pass Input and Output in the selector, I tried using *ngComponentOutlet but I couldn't pass input and output.

0

There are 0 answers