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

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

问题描述

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

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

<accordion close-others="oneAtATime"><accordion-group 标题="静态标题">此内容直接在模板中.</accordion-group><accordion-group Heading="{{group.title}}" ng-repeat="group in groups">{{group.content}}</accordion-group><accordion-group Heading="嵌套式手风琴"><accordion close-others="oneAtATime"><accordion-group 标题="静态标题">此内容直接在模板中.</accordion-group><accordion-group Heading="{{group.title}}" ng-repeat="group in groups">{{group.content}}</accordion-group></手风琴></accordion-group></手风琴>

Plunker 演示

解决方案

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

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

解决方案

Have you tried changing close-others= true;

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

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