Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional popovers #2188

Closed
bedag-moo opened this issue Feb 23, 2018 · 5 comments
Closed

Conditional popovers #2188

bedag-moo opened this issue Feb 23, 2018 · 5 comments

Comments

@bedag-moo
Copy link
Contributor

In #737, ngbTooltip was amended to only show a tooltip if the content is not falsy.

I'd like ngbPopover to behave the same way (currently, it shows an empty popover in this case).

Usecase

I'd like to show a different (or no) popover depending on the state of the element being hovered over. I had this working for a tooltip:

  <div [ngbTooltip]="helpKey || invalid ? tooltip : null" placement="bottom"
      triggers="hover focusin:focusout">

but the same approach with a popover

  <div [ngbPopover]="helpKey || invalid ? tooltip : null" placement="bottom"
      triggers="hover focusin:focusout">

shows an empty popover if passed null.

Version of Angular, ng-bootstrap, and Bootstrap:

Angular: 5

ng-bootstrap: 1.0.0

Bootstrap: 4

@bedag-moo
Copy link
Contributor Author

bedag-moo commented Feb 23, 2018

Workaround:

  <div [ngbPopover]="popoverTemplate" placement="bottom"
       #popover="ngbPopover" container="body" triggers="manual"
       (focusin)="(helpKey || invalid) && popover.open()" (focusout)="popover.close()" 
       (mouseenter)="(helpKey || invalid) && popover.open()" (mouseleave)="popover.close()" >

... though that doesn't hide the tooltip if the field becomes valid.

@pkozlowski-opensource
Copy link
Member

We should add proper support for disabled popovers / tooltips. Marking as a feature request.

medinarkhov added a commit to medinarkhov/ng-bootstrap that referenced this issue Mar 14, 2018
ngbTooltip was amended to only show a tooltip if the content is not falsy. It would be nice if ngbPopover behave the same way
medinarkhov added a commit to medinarkhov/ng-bootstrap that referenced this issue Mar 17, 2018
medinarkhov added a commit to medinarkhov/ng-bootstrap that referenced this issue Mar 17, 2018
pkozlowski-opensource pushed a commit that referenced this issue Apr 12, 2018
If title and content are empty, the popover won't open

Closes #2188
Closes #2217

BREAKING CHANGE:

Popovers with an empty title and content are considered deisabled
and won't open by default.
@anbaran
Copy link

anbaran commented Sep 17, 2018

In which version is this fixed? Because I use 1.1.2 (for Angular 5) and I still observe the failure behavior i.e. popover shows up even if content is empty

@debender495
Copy link

how to enter the popover on hover through an element , do some thing on the popover (click a link) and then leave on mouseleave

@saiyaff
Copy link

saiyaff commented Feb 10, 2020

In which version is this fixed? Because I use 1.1.2 (for Angular 5) and I still observe the failure behavior i.e. popover shows up even if content is empty

In the newest versions, there's a property called disablePopover that'd come handy.
Check on https://ng-bootstrap.github.io/#/components/popover/api

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants