0

I would like to create a dialog component with multiple HTML parts:

<my-dialog>
    <content>
        Here is first HTML content
    </content>
    <buttons>
        Here is second HTML content with a list of button HTML elements
    </buttons>
</my-dialog>

My question is if the my-dialog component can have the content and buttons parts directly as some templates parts or whether I need to create separate components for content and buttons parts.

Update: This question can be closed, as duplicate of Multiple ng-content.

Martin Staufcik
  • 8,295
  • 4
  • 44
  • 63
  • @cloned My question is, if the `my-dialog` component can have the `content` and `buttons` parts directly as some templates parts or whether I need to create separate components for `content` and `buttons`. – Martin Staufcik Dec 29 '21 at 08:05
  • You can do it however you like. Whatever makes most sense for your application and whatever gives you the best reusability in your project. – cloned Dec 29 '21 at 08:10
  • What about [hidden] or ngIf to hide or show some content based on some events ? – Amadou Beye Dec 29 '21 at 08:19
  • I am looking for a component with multiple `ng-content`, as shown here: https://stackoverflow.com/questions/52638718/multiple-ng-content. Sorry, I did not know how to name the problem better, I am new to Angular. – Martin Staufcik Dec 29 '21 at 08:23

0 Answers0