AngularJS ng-class不能使用:hover伪类

时间:2014-04-23 09:20:26

标签: css angularjs pseudo-class ng-class

悬停psuedoclass似乎不适用于ng-class ...任何想法?这是一个样本:

http://jsfiddle.net/75n6w/11/

<style>
    .orange {color:orange}
    .pointer-hover:hover {
        cursor: hand; cursor: pointer;
    }
</style>
<table ng-app>
    <thead>
        <th></th>
        <th>Orange<br />class</th>
        <th>Rollover<br />psuedoclass</th>
    </thead>
    <tr>
        <td>With class tag</td>
        <td class="orange">Orange</td> 
        <td class="pointer-hover">Hover pointer</td>
    </tr><tr>
        <td>With ng-class tag</td>  
        <td ng-class="{orange: 1==true}">Orange</td>  
        <td ng-class="{pointer-hover: 1==true}">Hover pointer</td>
    </tr>
</table>

1 个答案:

答案 0 :(得分:2)

看看控制台,你有错误。只需用撇号包装您的类名:

"{'pointer-hover': 1==true}"

更新了小提琴:http://jsfiddle.net/75n6w/12/