使用 AngularJS ui-bootstrap 将类添加到手风琴标题? [英] Add class to accordion heading using AngularJS ui-bootstrap?

查看:27
本文介绍了使用 AngularJS ui-bootstrap 将类添加到手风琴标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 ng-class 有条件地将一个类添加到 accordion-heading,但似乎甚至没有在元素上显式设置一个类得到保留.我有这个:

<div ng-repeat="currItem in items" 手风琴组><div Accordion-heading class="myClass">我的标题{{$index}}</div><div class="accordion-inner myClass">asdf asdf asdf</div>

还有小提琴:http://jsfiddle.net/Zmhx5/1/

当我检查手风琴标题元素时,找不到 myClass 类.有什么原因我不能在手风琴标题中添加类吗?

解决方案

您可以将 CSS 放在指令 accordion-heading 标签中:

<div class="myClass">我的标题{{$index}}</div></accordion-heading>

I want use ng-class to conditionally add a class to the accordion-heading, but it appears that not even setting a class explicitly on the element gets preserved. I have this:

<div accordion close-others="true">
    <div ng-repeat="currItem in items" accordion-group>
        <div accordion-heading class="myClass">My Heading {{$index}}</div>
        <div class="accordion-inner myClass">asdf asdf asdf</div>
    </div>
</div>

And the fiddle: http://jsfiddle.net/Zmhx5/1/

When I inspect the accordion heading element, the class myClass is nowhere to be found. Is there some reason I can't add classes to the accordion heading?

解决方案

You can put the CSS inside the directive accordion-heading tags:

<accordion-heading>
    <div class="myClass">My Heading {{$index}}</div>
</accordion-heading>

这篇关于使用 AngularJS ui-bootstrap 将类添加到手风琴标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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