Change the mouse pointer on ngclick

AngularjsAngularjs Ng-Click

Angularjs Problem Overview


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.

Angularjs Solutions


Solution 1 - Angularjs

> 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;
}

Solution 2 - Angularjs

All you have to do is use the cursor property

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

.pointer {
    cursor: pointer;
}

Solution 3 - Angularjs

Can be done via css, just add:

.yourClass { cursor: pointer; }

To your stylesheet

Solution 4 - Angularjs

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;    
}

Solution 5 - Angularjs

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

<div ng-click="myAngularFunctionWithinController()" style="cursor: hand;cursor: pointer;">
</div> 

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionskmvasuView Question on Stackoverflow
Solution 1 - AngularjsAndré DionView Answer on Stackoverflow
Solution 2 - AngularjsBeterrabaView Answer on Stackoverflow
Solution 3 - AngularjsEugenio CuevasView Answer on Stackoverflow
Solution 4 - AngularjsRenuView Answer on Stackoverflow
Solution 5 - AngularjsbdavidxyzView Answer on Stackoverflow