用法:https://ng-bootstrap.github.io/#/components/accordion/examples

我试图在父组件中的 ngb-accordion 内获取所有子组件 ngb-panel . 我做了下面的代码,但它没有工作..

app-component.html

<app-main>
   <app-child1></app-child1>
   <app-child2></app-child2>
</app-main>

main/main-component.html

<ngb-accordion #acc="ngbAccordion">
   <ng-content></ng-content>
</ngb-accordion>

main/child1/child1-component.html

<ngb-panel id="child1">
   <ng-template ngbPanelTitle>
      <h2>FIRST CHILD</h2>
   </ng-template>
   <ng-template ngbPanelContent>
       ....some content....
   </ng-template>
</ngb-panel>

main/child2/child2-component.html

<ngb-panel id="child2">
   <ng-template ngbPanelTitle>
      <h2>SECOND CHILD</h2>
   </ng-template>
   <ng-template ngbPanelContent>
       ....some content....
   </ng-template>
</ngb-panel>

有没有办法实现这个目标?基本上我想在一个家长手风琴中使用不同组件的不同手风琴面板 .