ng-单击手风琴面板标题 [英] ng-click on accordion panel header

查看:25
本文介绍了ng-单击手风琴面板标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究 angularjs uib-accordion ,我能够让它发挥作用,现在当我点击面板标题时,它会展开,这很好,但我正在尝试的是当我点击面板标题上的任何地方时,它也应该展开.需要一些建议.

I have been working on angularjs uib-accordion , I am able to make it functional, now when I click on panel title it expands that's fine, but what I am trying is when I click anywhere on panel heading it should also expand. Need some suggestion on it.

<uib-accordion>
    <uib-accordion-group style="border-radius:0px !important; margin:10px;"ng-repeat="filter in filterGroup" heading="{{filter.label}}">
        Some code
    </uib-accordion-group>
</uib-accordion>

推荐答案

如果您不介意向过滤器添加属性,您可以简单地将 is-open 属性分配给该属性并在 ng- 上切换它单击(如下所示).如果不想将属性分配给过滤器对象,那么还有其他方法(例如,将过滤器推入一个 isOpen 数组,以及 is-open="isOpen.indexOf(filter)>-1")

If you don't mind adding a property to the filter, you can simply have the is-open attribute be assigned to that property and toggle it on ng-click (as shown below). If you don't want the property to be assigned to the filter object, then there are other methods (for example, push the filter into an isOpen array, and is-open="isOpen.indexOf(filter)>-1")

<uib-accordion>
    <uib-accordion-group ng-repeat="filter in filterGroup" 
          heading="{{filter.label}}" 
          ng-click="filter.isOpen==!filter.isOpen" 
          is-open="filter.isOpen">
        ...
     </uib-accordion-group>
</uib-accordion>

这篇关于ng-单击手风琴面板标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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