问题描述
我想要一个动态的 ngb 手风琴,它允许我根据某些因素更改我显示的内容。但是,每次我尝试使用 <ng-template>
时,它都不会呈现它,也不会显示任何控制台错误。
我当前的代码看起来像这样(有更多模板,其中一些包含多个 ngb 面板和其他模板):
<ngb-accordion #acc="ngbAccordion">
<ngb-panel id="toggle-workspaces" title="Workspaces">
<ng-template ngbPanelContent>
<span> This shows </span>
</ng-template>
</ngb-panel>
<ng-container [ngTemplateOutlet]="templateThatIWantToShow">.
</ng-container>
</ngb-accordion>
<ng-template #templateThatIWantToShow>
<ngb-panel id="someId" title="It doesn't show">
<ng-template ngbPanelContent>
<span>I can't see this</span>
</ng-template>
</ngb-panel>
</ng-template>
起初,我认为这可能是标签包装的问题,但问题是 ng-container 和 ng-template 代码放在那里没有任何包装。所以我认为问题可能与在 ng-container 之前处理的手风琴有关,但我也不确定。有什么办法可以做到这一点吗?谢谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)