父母关闭时关闭嵌套的UI Bootstrap手风琴

时间:2013-12-24 01:23:55

标签: angularjs accordion directive transclusion

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

当我关闭'父母'时,我想关闭它的'孩子'。我遇到了麻烦,因为手风琴指令使用了翻译,而且范围实际上是兄弟姐妹不是孩子的父母。

<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

1 个答案:

答案 0 :(得分:0)

您是否尝试过更改close-others = true;