Change the mouse pointer on ngclick

2020-05-21 07:19发布

I've a div with the Angular ng-click directive attached to it. On hovering over this element the mouse pointer doesn't change. Is there a way to change it through CSS? I know I can simply attach an anchor tag to it, but I would like to know if this can be done.

5条回答
聊天终结者
2楼-- · 2020-05-21 07:53

If you are using datatables, you have to override the default datatables.css settings and add the following code to custom CSS, In the code below row-select is the class that I added on datatables in my HTML page.

table.row-select.dataTable tbody td
{
cursor: pointer;    
}
查看更多
时光不老,我们不散
3楼-- · 2020-05-21 07:54

Is there a way to change it through css?

Yes, see cursor.

If you just wanted to target elements with the ng-click attribute, for example:

[ng-click],
[data-ng-click],
[x-ng-click] {
    cursor: pointer;
}
查看更多
闹够了就滚
4楼-- · 2020-05-21 08:00

All you have to do is use the cursor property

<div data-ng-click="myFun()" class="pointer"></div>

.pointer {
    cursor: pointer;
}
查看更多
趁早两清
5楼-- · 2020-05-21 08:10

Yes you can achieve it simply through CSS, nothing special about AngularJS here.

<div ng-click="myAngularFunctionWithinController()" style="cursor: hand;cursor: pointer;">
</div> 
查看更多
男人必须洒脱
6楼-- · 2020-05-21 08:12

Can be done via css, just add:

.yourClass { cursor: pointer; }

To your stylesheet

查看更多
登录 后发表回答