angular-strap icon indicating copy to clipboard operation
angular-strap copied to clipboard

Can't add tooltip on link with target attribute

Open just-boris opened this issue 11 years ago • 11 comments

I want to show hints about external links on my site:

<a href="http://github.com" target="_blank" bs-tooltip data-title="Opens in new tab">Open github</a>

It is not works and I see an exception on console for each hover

Uncaught TypeError: Cannot read property 'getBoundingClientRect' of undefined 

It caused by that tooltip try to find a target from attribute. But it is not setting for it. Maybe it should to read only value from data-target not just target

Here is reproduction of issue http://plnkr.co/edit/CMj7nX?p=preview

just-boris avatar Jan 22 '15 15:01 just-boris

Hi,

I have the same problem when i put a target attribute.

I don't know why but the option object is settled by a JQuery object !?

[jquery: "2.1.1", constructor: function, selector: "", toArray: function, get: function…]length: 0

Pending the correction, i changed one line in the source code :-/ (https://github.com/mgcrea/angular-strap/blob/master/dist/angular-strap.js#L4544) : ~~$element = $element || (options.target || element);~~ became

$element = $element || element || options.target;

grrseguin avatar Jan 23 '15 10:01 grrseguin

Created a pull request with fix for it

just-boris avatar Jan 23 '15 12:01 just-boris

The Fix you checked in did not work, I've downloaded the newest tooltip js and I got the same Error.

The Solution grrseguin posted works fine when I use the code snipped he wrote.

--> Can you please reopen the Bug

squadwuschel avatar Feb 02 '15 09:02 squadwuschel

I was still have the same issue and the solution grrseguin posted also works for me. Thanks.

dreamoftrees avatar Mar 05 '15 18:03 dreamoftrees

@squadwuschel @dreamoftrees if you provide an example with bug, I can find a better solution than already done.

just-boris avatar Mar 06 '15 13:03 just-boris

Here I've created a plunker from the original plunker tooltip example and modified the "Click me" Button to link with Target

http://plnkr.co/edit/vwojRZEmlzZ2WtKxAu2F?p=preview

<a class="btn btn-primary" target="_blank" type="button" data-trigger="click" data-type="success" data-title="{{tooltip.title}}" bs-tooltip>Click me</a>

and there is no Tooltip working any more

squadwuschel avatar Mar 07 '15 21:03 squadwuschel

@squadwuschel your example uses a version 2.1.6 which doesn't include my fix. Try to use with 2.2.0

@mgcrea @vmlf01 could you please update build files in dist folder and on homepage? Now it's quite hard to make an example using latest version

just-boris avatar Mar 08 '15 14:03 just-boris

I can check the old example when the dist folder ist updated If the bug is there

squadwuschel avatar Mar 08 '15 18:03 squadwuschel

This has caused using a data-target with an expression (e.g. '#data-{{$index}}') to no longer work, as the string is not interpolated and instead of passing through '#data-0' now passes in '#data-{{$index}}', which does not match the element correctly, and the popover fails.

M21B8 avatar Oct 19 '15 16:10 M21B8

👎 still broken any chance of a fix?

adamseckel avatar Jun 28 '16 19:06 adamseckel

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 25 '19 20:01 lock[bot]