2

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

Plunker 演示

4

1 回答 1

0

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

于 2017-01-19T14:12:34.203 回答