Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Angular UI Bootstrap popover prevents ng-click #456

Closed
mokesmokes opened this issue May 21, 2013 · 9 comments
Closed

Angular UI Bootstrap popover prevents ng-click #456

mokesmokes opened this issue May 21, 2013 · 9 comments
Milestone

Comments

@mokesmokes
Copy link
Contributor

Simple Plunk illustrating my issue: How can I get ng-click to work when I have a popover on the element?
http://plnkr.co/edit/wI0jqq?p=preview
For example - make the top button (with popover) disappear like the second button.
Thanks,
Mark

@pkozlowski-opensource
Copy link
Member

@joshdmiller I had a quick look at this one and couldn't figure out what is going on here... Suspect a scoping issue but couldn't pin-point it...

@joshdmiller
Copy link
Contributor

@pkozlowski-opensource This one slipped past me. It looks at first glance like a scoping issue because the popover creates a new child scope and the plunker uses a primitive, so it would never work anyway. But once I fixed that in the Plunker, I exposed the actual issue: it's a little ordering bug here: https://github.com/angular-ui/bootstrap/blob/master/src/tooltip/tooltip.js#L257. When the mouseover trigger is applied, it's unbinding the previous trigger; since there was no previous trigger, it's unbinding the default, which is a click. So, unbinding the click removes the ngClick action. Oops.

I'll push a fix this weekend.

@oportocala
Copy link

Any news on this?

@mokesmokes
Copy link
Contributor Author

0.4 still has this bug, but you can work around it by placing the popover in a different element than the one you want ng-click on. For example, in my Plunker, move the popover to the enclosing <p> element, and it will work.

@ndk-
Copy link

ndk- commented Nov 17, 2013

And why this issue is closed ?
I changed version to 0.6.0 in the provided example and it still doesn't work...
I have the similar problem with tooltips...

@pkozlowski-opensource
Copy link
Member

@ndk- this issue was closed since the problem reported here was fixed. If you've got a similar problem open a separate issue with a minimal reproduce scenario using http://plnkr.co/

@ndk-
Copy link

ndk- commented Nov 17, 2013

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

I don't see ANY fixes... show me please.

@pkozlowski-opensource
Copy link
Member

@ndk- your problem has nothing to do with the fix discussed in this issue. What is going on is that you are bumping into a scoping issue. Tooltips / popovers are creating child scopes so your ngClick expressions are evaluated in the context of this child scope. Possible work-arround: http://plnkr.co/edit/aiOXsI8D3IHjlJWkwA3w?p=preview

@ndk-
Copy link

ndk- commented Nov 17, 2013

It's not my problem, it's the original problem. All i did: changed versions of ui-bootstrap and angularjs. I still do not understand why this bug is closed, since the original issue requires workaround.

codedogfish pushed a commit to codedogfish/angular-ui-bootstrap that referenced this issue Sep 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants