最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to display text in hover over in angularjs? - Stack Overflow

programmeradmin2浏览0评论

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?

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?

Share Improve this question edited Apr 18, 2018 at 8:13 Dylan Watson 2,3232 gold badges20 silver badges38 bronze badges asked Mar 8, 2015 at 9:00 butYouDontLookLikeADeveloperbutYouDontLookLikeADeveloper 3371 gold badge6 silver badges23 bronze badges 4
  • You want to show it where? – dfsq 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> – butYouDontLookLikeADeveloper Commented Mar 8, 2015 at 9:36
  • Dylan Watson gave you the simplest and the most efficient answer how to do this. – dfsq 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}} – butYouDontLookLikeADeveloper Commented Mar 8, 2015 at 9:52
Add a comment  | 

2 Answers 2

Reset to default 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)

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

发布评论

评论列表(0)

  1. 暂无评论