bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

$tooltipProvider - how do I actually use setTriggers() ?

Open franciscopreller opened this issue 13 years ago • 19 comments

The documentation states that I am able to set new triggers using the $tooltipProvider and setTriggers() method, however I have so far been unable to achieve this.

I have included this in my module config:

$tooltipProvider.setTriggers({ 'inputInvalid' : 'inputValid' });

However it does not find the method. I dived into the source and see the method there, but it's tossed inside a $get method which then returns the dependencies. Perhaps I am doing something wrong here and I simply do not understand how to get the $tooltipProvider to work?

franciscopreller avatar Jul 05 '13 05:07 franciscopreller

@franciscopreller Sends us a plunker (http://plnkr.co/) with what you've tried so far. Also, since this is a question, it should be asked on the mailing list ([email protected]).

pkozlowski-opensource avatar Jul 05 '13 06:07 pkozlowski-opensource

Thanks, will move it to google groups then, was unsure where else to get help.

franciscopreller avatar Jul 05 '13 06:07 franciscopreller

@franciscopreller Did you ever figure out how to properly use setTriggers()? I looked for your post on Google Groups but wasn't able to find it.

baconmania avatar Jul 18 '13 17:07 baconmania

@baconmania Hey, yes I did. Was something simple like updating from an old version. Became apparent when I set it up on plunker exactly the same and it worked as it should have.

franciscopreller avatar Jul 20 '13 00:07 franciscopreller

Francis, could you please provide your plunker? I believe I need the same functionality.

jabb0r avatar Aug 21 '13 18:08 jabb0r

I spent some time today researching how to set up ui-bootstrap triggers to respond to custom events for my project, so I threw what I found into a plunker: http://plnkr.co/edit/0wEqzz?p=preview . In my case, I needed to be able to trigger a popup on element A when hovering the mouse over element B.

courtneyfaulkner avatar Apr 24 '14 20:04 courtneyfaulkner

@courtneyfaulkner, that was super helpful to me, thanks very much!

tplorts avatar Jun 25 '14 18:06 tplorts

@courtneyfaulkner, you are a wizard! thank you so much for putting your effort into that plunker, it is extremely helpful) thanks a bunch!

olgakostrub avatar Jul 24 '14 10:07 olgakostrub

Happy to help. :)

courtneyfaulkner avatar Jul 24 '14 17:07 courtneyfaulkner

@courtneyfaulkner perfect demo :)

MigCoder avatar Aug 02 '14 08:08 MigCoder

@courtneyfaulkner Is it actually necessary to name also the default triggers? I think the given object is extending the default one. So this should work:

$tooltipProvider.setTriggers({'customEvent': 'customEvent'});

Elijen avatar Oct 13 '14 11:10 Elijen

@Elijen No, it's not necessary. The default trigger map

{
    'mouseenter': 'mouseleave',
    'click': 'click',
    'focus': 'blur'
}

will be extended with the attributes in .setTriggers().

courtneyfaulkner avatar Oct 13 '14 16:10 courtneyfaulkner

@courtneyfaulkner Thank you so much for the Plunkr demo, very helpful to us Angular n00bs

MattSidor avatar Feb 06 '15 22:02 MattSidor

@courtneyfaulkner thanks alot! great plnkr. In my case i had to trigger the popover to close when selecting an item inside the popover.

VictorCoding avatar Jun 05 '15 21:06 VictorCoding

Thx, @courtneyfaulkner. :smile:

thotty avatar Sep 04 '15 17:09 thotty

I'm happy I could help. :)

courtneyfaulkner avatar Sep 04 '15 18:09 courtneyfaulkner

The plunler is broken with the 0.13.4 release of the 3 september 2015.

Use popover-is-open instead

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

cyrilgandon avatar Sep 07 '15 13:09 cyrilgandon

Ah, interesting. I was reading your issue #4364, @cyrilgandon, and spent some time with uib 0.14.1 in plunkr. I was able to get a custom event to fire the uib-tooltip once by using $('#tooltipTarget')[0].dispatchEvent(new Event('customEvent'));, which is not intuitive, and also fails to work on subsequent mouseovers. Per #4364, it seems they're still trying to fix their handling of custom events. 0.14.1 seems to be handling tooltip-is-open functionality pretty well, but in 0.13.4, I'm seeing bad tooltip positioning problems. I updated my http://plnkr.co/edit/0wEqzz?p=preview plunkr to be similar to yours, to avoid confusion for people coming across this thread. If/when they fix custom events, I may update my plunkr again.

courtneyfaulkner avatar Oct 13 '15 17:10 courtneyfaulkner

@courtneyfaulkner toolip-is-open approach isn't stable with tooltip-popup-delay. I can't find a way to clear a delay timeout without custom triggers. So the tooltip showing after a delay no matter if you set open to false.

DzmVasileusky avatar Jul 18 '17 13:07 DzmVasileusky