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.
Asked
Active
Viewed 1.1e+01k times
69

naXa stands with Ukraine
- 35,493
- 19
- 190
- 259

skmvasu
- 3,098
- 3
- 24
- 29
5 Answers
185
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;
}

André Dion
- 21,269
- 7
- 56
- 60
-
Is there a way to add an exception to this? F.I. All ng-clicks should have pointer as cursor except the ones that have X class(or any other CSS attribute) – Murilo May 26 '16 at 00:15
-
1@Murilo, yes. For example, `.x[ng-click] { cursor: default; }` – André Dion May 26 '16 at 11:23
-
12Does anyone know how to accomplish this in Angular 2? Angular 1 used `ng-click` whereas Angular 2 uses `(click)`. – cbrawl Jan 23 '17 at 22:26
-
For angular 2 have a look at https://stackoverflow.com/questions/58716247/how-to-apply-cursor-pointer-property-to-click-event-handler This solution uses a directive to achieve this, so it is not a pure CSS solution. – Tom May 27 '22 at 11:55
6
Can be done via css, just add:
.yourClass { cursor: pointer; }
To your stylesheet

Eugenio Cuevas
- 10,858
- 3
- 29
- 51
1
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;
}
-2
Yes you can achieve it simply through CSS, nothing special about AngularJS here.
<div ng-click="myAngularFunctionWithinController()" style="cursor: hand;cursor: pointer;">
</div>

bdavidxyz
- 2,492
- 1
- 20
- 40
-
-
Because it will cover all cases, all browsers http://stackoverflow.com/questions/3087975/how-can-i-make-the-cursor-a-hand-when-a-user-hovers-over-a-list-item – bdavidxyz Sep 19 '13 at 14:25
-
6`cursor:pointer` will immediately override `cursor:hand` and there aren't any browsers in the wild today that don't correctly support this property (did you actually read the thread you linked to?). Also, applying the style inline isn't going to suit OP's use-case unless he adds that to every element that has an `ng-click` attribute, which really defeats the purpose of using CSS at all. – André Dion Sep 19 '13 at 14:28