8

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?

4
  • You want to show it where? Commented Mar 8, 2015 at 9:23
  • Just like how you would hover over a box(<td>) and I want a little bubble showing a value when a user hover over the <td> Commented Mar 8, 2015 at 9:36
  • Dylan Watson gave you the simplest and the most efficient answer how to do this. Commented Mar 8, 2015 at 9:41
  • There is a problem with that, It is not printing the value, it is just print the expression as it is : {{project.inrtcvalue}} Commented Mar 8, 2015 at 9:52

2 Answers 2

15

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)

Sign up to request clarification or add additional context in comments.

6 Comments

The html 'title' attribute will show the text when you mouseover the element (In this case, the td element)
This is printing {{project.inrtcvalue}}, rather than the actual value
Interesting.. Is your ng-repeat displaying the values within your table correctly?
Here is a demo of it working (first column): plnkr.co/edit/RQOTmteiJ86ZjENEzE1p?p=info
@maaartinus Script path was broken. plnkr.co/edit/upuGp6IoSXqLdaAi3kX5?p=preview
|
5

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

1 Comment

How would I show the bubble showing the text on hover if I follow that example?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.