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

Popover: data - trigger: How to "NOT" trigger a popover.

Open bharathk16 opened this issue 12 years ago • 11 comments

I have a HTML code like this on the button: data-trigger="{{{true: 'hover', false:'never'}[form.$invalid]}}"

The popover triggers when form is invalid(which will fire 'hover'). And I want the popover NOT to trigger when form is valid i.e "false: never" . And this "false:never" isn't working. Is there any work around for this...?

bharathk16 avatar Oct 20 '14 15:10 bharathk16

Try using false: 'manual', that should do what you want.

vmlf01 avatar Oct 20 '14 18:10 vmlf01

Tried with 'manual' but still the same issue.

bharathk16 avatar Oct 20 '14 20:10 bharathk16

Can you give us a plunker sample? I tried the docs example with data-trigger="manual" and the popover didn't show on hover or click, so maybe I didn't understand what you needed?

vmlf01 avatar Oct 20 '14 21:10 vmlf01

I tried with data-trigger='manual', it's working fine, the the popover didn't show on hover or click. But when I use in this way: data-trigger="{{{true: 'hover', false:'manual'}[form.$invalid]}}", the popovers are still showing even when form is valid. Sure will provide a plunker sample..in next post.

bharathk16 avatar Oct 20 '14 21:10 bharathk16

here's the plunker sample: http://plnkr.co/edit/eMsWxXmFX6hVQbzryQ3L?p=preview

bharathk16 avatar Oct 20 '14 22:10 bharathk16

I see your problem now. I didn't remember you would need to change the trigger value dynamically, and the popover is not watching the trigger attribute for changes, so it won't work as is.

Maybe you can create a custom directive which uses the $popover service and add the tracking/checking of the form status there.

I'm also submitting a PR for a new bsEnabled attribute that would allow for enabling/disabling the directive that might solve this issue in the future.

vmlf01 avatar Oct 21 '14 11:10 vmlf01

bsEnabled has been added in 957fd18.

vmlf01 avatar Nov 02 '14 16:11 vmlf01

@vmlf01 : So can I write like this.?

data-trigger = "hover" bs-enabled = "form.$invalid"

bharathk16 avatar Nov 20 '14 16:11 bharathk16

Yep, that's the idea, but I see now that the PR only does it for tooltip. Now it needs to be added to the other directives that use tooltip. Check this updated plunker with the tooltip: http://plnkr.co/edit/P4XCPm9K9rc6zZLXWbxs?p=preview

vmlf01 avatar Nov 20 '14 16:11 vmlf01

Yep..! thanks for the plunker!

bharathk16 avatar Nov 20 '14 16:11 bharathk16

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 26 '19 11:01 lock[bot]