0

I want to be able to build custom Angular components, but then compose them, like this:

<app-my-parent-component>
  <app-my-child-component1></app-my-child-component1>
  <app-my-child-component2></app-my-child-component2>
</app-my-parent-component>

...and so on. In React, you do this in the parent component using the children prop, but so far, I have no idea how to do this in Angular.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
hairbo
  • 3,113
  • 2
  • 27
  • 34
  • So.. not sure what your exact question is . What you show is of course possible. You’ll compose those components inside a template in angular (which in itself is also controlled by a component). It’ll be nice if you can expand on a more specific scenario, possibly with some actual experimental code so we can assist you further. – MikeOne Sep 08 '22 at 16:49
  • Does this answer your question? [How to get Children component like in React's this.props.children in Angular 2?](https://stackoverflow.com/questions/40476427/how-to-get-children-component-like-in-reacts-this-props-children-in-angular-2) – jonrsharpe Sep 08 '22 at 16:52
  • Yeah, I think it's `ng-content` that I want, and so the post @jonrsharpe included is where to look here. – hairbo Sep 08 '22 at 17:54

0 Answers0