AngularJS中ng-class与:hover伪类不起作用

3
Hover伪类与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个回答

2

请看控制台,你有一个错误。只需要使用单引号括起你的类名:

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

更新的示例代码:http://jsfiddle.net/75n6w/12/


哦,那很简单!非常感谢。 - Steve

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接