父级关闭时,关闭嵌套的UI Bootstrap手风琴 [英] Close nested UI Bootstrap accordion when parent closes

查看:71
本文介绍了父级关闭时,关闭嵌套的UI Bootstrap手风琴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在AngularJS中,我正在使用bootstrapUI手风琴指令,该指令在其中一个窗格中包含嵌套的手风琴。

In AngularJS I am using a bootstrapUI accordion directive that contains a nested accordion in one of the panes.

当我关闭父母时,我想关闭其孩子。我遇到了麻烦,因为手风琴指令使用了包含,并且作用域实际上是兄弟姐妹,而不是父母的父母。

When I close the 'parent' I would like to close its 'children'. I am having trouble because the accordion directive uses transclusion, and the scopes are actually siblings not parent to child.

<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>

柱塞演示

Plunker demo

推荐答案

您是否尝试过更改close-其他=真;

Have you tried changing close-others= true;

这篇关于父级关闭时,关闭嵌套的UI Bootstrap手风琴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆