Use any selector for popover container
See original GitHub issueNow we append popover in the element or body. It will be good to give possibility append it in any element
<button type="button" ngbPopover="text..." container=".my-block">
Popover appended to element with class .my-block
</button>
Furthermore it removes hardcode
if (this.container === 'body') { //can change to `if (this.container) {...}`
window.document.querySelector(this.container).appendChild(this._windowRef.location.nativeElement);
}
Version of Angular, ng-bootstrap, and Bootstrap:
Angular: 4.4.4
ng-bootstrap: 1.0.0-beta.5
Bootstrap: 4.0.0-beta
Issue Analytics
- State:
- Created 6 years ago
- Reactions:13
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Popovers - Bootstrap
Popovers that use delegation (which are created using the selector option) cannot be individually destroyed on descendant trigger elements.
Read more >bootstrap popover with container set for the "body" does not ...
You have to use the selector attribute to destroy/hide the popover: http://jsfiddle.net/fScua/363/ $('.button').click(function(){ ...
Read more >Popovers · Bootstrap
$(function () { $('[data-toggle="popover"]').popover() }). Example: Using the container option. When you have some styles on a parent element that interfere ...
Read more >Bootstrap JS Popover Reference - W3Schools
Name Type Default Try it
animation boolean true Try it
container string, or the boolean false false Try it
content string "" Try it
Read more >Bootstrap popovers - CoreUI
Popovers can be triggered thanks to an element inside a shadow DOM. By default, this component uses the built-in content sanitizer, which strips...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We have the same use scenario as @cwhaught. We currently run two versions of bootstrap while we are in the slow process of converting everything to newer tech. We have this issue for other components like dropdowns and tooltips as well. The
container
attribute seems to imply you can pick the container so we were shocked when it was hard coded to only acceptbody
.@pkozlowski-opensource I would never wrote about it if no real use-case 😃 See example, open popovers and try to scroll: https://plnkr.co/edit/b3411ErjSO3vAY0CBls7?p=preview
I want use popover in the grid, and it has to be clipped by grid-container, but not clipped by grid-cell