Angular UI中是否有方法在手风琴中设置手风琴?我希望顶级列表全部关闭,直到选中一个项目,然后打开手风琴以显示另一个也将打开和关闭的手风琴列表。
使用我当前的实现,当我选择内部列表项时,两个手风琴都被触发,而内部手风琴被关闭。他们不在自己的美元范围内吗?
这个问题类似,但对于jQuery:accordion within accordion collapses parent accordion
<accordion>
<accordion-group ng-repeat="folder in folders | orderBy:'name' " ng-click="select_folder(folder)">
<accordion-heading>
{{ folder.name }}
</accordion-heading>
<accordion>
<accordion-group ng-repeat="file in folder.files">
<accordion-heading>
{{ file.name }}
</accordion-heading>
{{ file.info }}
</accordion-group>
</accordion>
</accordion-group>
</accordion>
答案 0 :(得分:0)
我想我发现了这个问题。 ng-click
标记上不应包含<accordion-group>
属性。通过将其向下移动到<accordion-heading>
标签,嵌套的手风琴可以正常工作。这也在这里讨论:https://stackoverflow.com/a/18497935/584846
<accordion>
<accordion-group ng-repeat="folder in folders | orderBy:'name' ">
<accordion-heading>
<span ng-click="select_folder(folder)">{{ folder.name }}</span>
</accordion-heading>
<accordion>
<accordion-group ng-repeat="file in folder.files">
<accordion-heading>
<span ng-click="select_folder(folder)">{{ file.name }}</span>
</accordion-heading>
{{ file.info }}
</accordion-group>
</accordion>
</accordion-group>
</accordion>
另一种方法是$watch
is-open
属性中的值:https://stackoverflow.com/a/15642577/584846