0

I have a accordion component. The component has togglable content that is actually <ng-content>. I have a form component that should to appear after accrodion's title, in its content. So I want to use only one form component for all accordion items. How to do this?

What I mean:

<template ngFor let-item [ngForOf]="items">
  <accorion [title]="item.title">
    <my-form></my-form>
    <!-- So it will put multiple my-form components. -->
    <!-- But I want to insert the form dynamically. -->
  </accorion>
</template>
Lyubimov Roman
  • 1,269
  • 15
  • 27
  • Can you please provide more code? I don't get what the problem is. Where is ``? – Günter Zöchbauer Oct 28 '16 at 05:59
  • I will try to give you the code later, I don't have real code for accordion now. Just want to understand it is possible or not. Accordion component would have `` in its template. So in the example above `` would be transcluded in it. – Lyubimov Roman Oct 28 '16 at 06:03
  • 1
    I think a similar approach to http://stackoverflow.com/questions/36325212/angular-2-dynamic-tabs-with-user-click-chosen-components/36325468#36325468 might work for you. – Günter Zöchbauer Oct 28 '16 at 06:05
  • Thanks, not the same that I wanted but it will be useful anyway! – Lyubimov Roman Oct 29 '16 at 08:59

0 Answers0