0

In a large form, I'm using popovers to display error messages from the validation (I know, not best practice).

Now, I also want to add tooltips to display detailed explanation of the input.

However, using both, the tooltip and the popover directive (and their associated -trigger and -placement directives), the behavior is odd/buggy: Both, tooltip and popover are placed based on the popover-placement directive (ignoring the tooltip-placement) - and display the text provided for the popover.

<button class="btn btn-default"
    popover="Popover" popover-trigger="mouseenter" popover-placement="right" 
    tooltip="Tooltip" tooltip-trigger="mouseenter" tooltip-placement="top" >
Label</button>

See this plunkr.

Any idea how to make this work?

1
  • 1
    The popover directive calls the tooltip provider to generate the popover element, so you are essentially trying to have 2 tooltips on the same element.
    – Rob J
    Commented Aug 29, 2014 at 20:07

2 Answers 2

3

They actually infact use the same placement function.

From the docs on popover:

The popover directive also supports various default configurations through the $tooltipProvider. See the tooltip section for more information.

Meaning if you had the following code:

app.config(['$tooltipProvider', function($tooltipProvider){
  $tooltipProvider.options({
    'placement': 'right'
  });
}]);

It would change the default for both tooltips and popovers.

Best I can think of is it have some sort of wrapper around the element so you can do each in turn.

<button class="btn btn-default sampleBtn"
  popover="Popover" popover-trigger="mouseenter" popover-placement="right">
  <span tooltip="Tooltip" tooltip-trigger="mouseenter"  tooltip-placement="top">
    Tooltip + Popover
  </span>
</button>

Demo in Plunker

screenshot

0
1

A very Simple Way..Just Make a parent Span for the button and attach those properties with that Span. I have Some Code for that too

<span title="Popover title" data-container="body" data-toggle="popover" data-placement="bottom" data-content="Some content in Popover on bottom">
       <button type="button" class="btn btn-default" data-toggle="tooltip"  data-placement="right" title="Tooltip on right">Tooltip on right</button>
</span>

Here is the JS Fiddle for that too

http://jsfiddle.net/h75k1fzj/

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.