I am facing an issue with reusing a component called wrapper with different child components. I found some helpful resources such as this SO question and this article. However, these only address cases where the child component is known in advance. In my scenario, I may need to pass in a simple div
or h2
.
Below is a snippet of the code showcasing the minimal reproduction of the issue:
<app-wrapper>
<app-edit-address></app-edit-address>
</app-wrapper>
<app-wrapper>
<div>
<label>Edit Email</label>
<input />
</div>
</app-wrapper>
<app-wrapper>
<h2>
Unauthorized
</h2>
</app-wrapper>
In React, rendering children dynamically is easy with {props.children}
, but in Angular, I'm struggling to find a solution. How can I render children dynamically without knowing them beforehand?