Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display text in hover over in angularjs?

I am very new to AngularJS. I want to display {{Project.inrtcvalue}} when the mouse is hovered over values. How can I do this in AngularJS?

<table ng-table="tableParams" show-filter="true" class="table" >
    <tr  ng-class="{'danger': project.rag <= 35, 'warning': project.rag > 35 && project.rag < 70  , 'success': project.rag > 70}" ng-repeat="project in $data">
        <td data-title="'PRN'" sortable="'prn'" filter="{'prn': 'text'}">
            {{project.prn}}
        </td>
    </tr>
</table>

So when the user hovers over these <td> I want to display a value from a controller. How do I do this? What is the best way to do this?

like image 814
butYouDontLookLikeADeveloper Avatar asked Mar 08 '15 09:03

butYouDontLookLikeADeveloper


People also ask

How to use mouseover in AngularJS?

AngularJS ng-mouseover DirectiveThe ng-mouseover directive tells AngularJS what to do when a mouse cursor moves over the specific HTML element. The ng-mouseover directive from AngularJS will not override the element's original onmouseover event, both will be executed.

What is hover over text?

When you enable Hover Text on your Mac, you can move the pointer over something on the screen — for example, text, an input field, a menu item or a button — and display a high-resolution zoomed version of it in a separate window.


2 Answers

You should simply be able to use the {{variable}} notation within a HTML title tag.

So something like:

<td title="{{project.inrtcvalue}}">

See this plunkr for an example (Thanks dfsq)

like image 142
Dylan Watson Avatar answered Sep 28 '22 06:09

Dylan Watson


You can use ng-mouseover and ng-show directives to accomplish this.Following is the example. Example .Hope it helps to get you started.

like image 36
Kamran Avatar answered Sep 28 '22 08:09

Kamran