【发布时间】:2013-12-24 01:23:55
【问题描述】:
在 AngularJS 中,我使用了一个 bootstrapUI 手风琴指令,该指令在其中一个窗格中包含一个嵌套手风琴。
当我关闭“父级”时,我想关闭它的“子级”。我遇到了麻烦,因为手风琴指令使用了嵌入,而作用域实际上是兄弟姐妹而不是父子关系。
<div ng-controller="AccordionDemoCtrl">
<accordion close-others="oneAtATime">
<accordion-group heading="Static Header">
This content is straight in the template.
</accordion-group>
<accordion-group heading="{{group.title}}" ng-repeat="group in groups">
{{group.content}}
</accordion-group>
<accordion-group heading="Nested Accordian">
<accordion close-others="oneAtATime">
<accordion-group heading="Static Header">
This content is straight in the template.
</accordion-group>
<accordion-group heading="{{group.title}}" ng-repeat="group in groups">
{{group.content}}
</accordion-group>
</accordion>
</accordion-group>
</accordion>
</div>
【问题讨论】:
-
我获取了 bootstrapUI 源并对其进行了扩展,以通过 'id' 元素属性跟踪 rootScope 中的继承。这感觉不像是“角度方式”,所以我仍然对另一种方法感兴趣。
标签: angularjs accordion directive transclusion