9

I want to add a tooltip which would be displayed on mouse hover of the below elements.

<a ng-click="click(this)">
<span class="icon"></span>
</a>
{{product.title}}

I have the tooltip in product.desc. I tried using the below code:

 <span tooltip="{{product.desc}}" class="glyphicon"></span>

But this doesnt work. Any Ideas/Suggestions? please help.

[EDIT] I can see the value of product.desc exists as expected in source of the page when i checked using developer tools.

Thankyou

3
  • Try with title <span title="{{product.desc}}" class="glyphicon"></span> Commented Mar 26, 2015 at 9:53
  • Whether I Use Title or ToolTip, the value doesnt get displayed in the mouse hover. I checked in the source, F12 developer tools.I am able to see the product.desc value being displayed in the source(using ToolTip or Title, both ways, value is coming in html source.) Please suggest. Commented Mar 26, 2015 at 9:57
  • Do you want to open a tooltip on element B when you are hovering on element A? Commented Mar 26, 2015 at 10:17

3 Answers 3

2

Instead of

<span tooltip="{{product.desc}}" class="glyphicon"></span> 

we need to give

<span data-toggle="tooltip" title="{{product.desc}}" class="glyphicon"></span>
2

None of the answers above solved my problem. This is what worked for me:

Instead of

<span data-toggle="tooltip" title="{{product.desc}}" class="glyphicon"></span>

we need to say:

<span data-toggle="tooltip" data-original-title="{{product.desc}}" class="glyphicon"></span>
1

Which version of angular are you using? A couple of things could be happening... I've spent the past 9 months developing angular apps all of which have leveraged the tooltip library.

Assuming you are using the tooltip library from angular-ui

  • Make sure you are referencing the angular-ui module in your in app.js module dependencies

angular.module('ValuesEntryApp', ['ui.bootstrap', ...more depedencies,]).config(funciton(){...});

  • Angular 1.3 has a known issue with angular-ui tooltips: issue/solution

Other things: You said that even if you use the title tag it still doesn't render a tooltip? I think it depends on what browser you use but I know atleast in chrome that if you hover and hold over an element with a title it will display the title for a short while. Is your glyphicon even rendering on screen? Are there any errors in your console? Give us more info if you still seeking help. I could help get it working for you if we had more info on you dev setup.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.