twitter-bootstrap popover 元素的 popover-append-to-body 属性在 angular-ui 中似乎不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20347097/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
popover-append-to-body attribute for a popover element doesn't seem to work in angular-ui
提问by Benjamin Crouzier
I am using angular UI. (docs, github)
I would like to make a popover that is appended on body.
我想制作一个附加在身体上的弹出框。
In pure bootstrap, you have to use
container: 'body'so that your popover is appended on the body element instead of the parent element of your popover. (see http://getbootstrap.com/2.3.2/javascript.html#popovers)In Angular UI, you are supposed to use
popover-append-to-body(see http://angular-ui.github.io/bootstrap/#/popover).
在纯引导程序中,您必须使用,
container: 'body'以便您的 popover 附加到 body 元素而不是 popover 的父元素上。(见http://getbootstrap.com/2.3.2/javascript.html#popovers)在 Angular UI 中,您应该使用
popover-append-to-body(参见http://angular-ui.github.io/bootstrap/#/popover)。
But I tried this attribute, and my popover is not appended on body. (Note that other attributes, such as placement='right'do work.)
但是我尝试了这个属性,我的弹出框没有附加到正文中。(请注意其他属性,例如placement='right'do 工作。)
Html for the popover:
弹出窗口的 Html:
<a popover="click me" popover-placement='bottom' popover-append-to-body='true'>
popover text
</a>
Note: In the source, I don't find anything related to popover-append-to-body
注意:在源代码中,我没有找到任何与popover-append-to-body
回答by Benjamin Crouzier
It looks like it works with the latest version of angular ui.
看起来它适用于最新版本的 angular ui。
In this plunkerit does work. (click run, then click dynamicPopoverText, then inspect popover and see that it's indeed just below body).
在这个plunker中它确实有效。(单击运行,然后单击dynamicPopoverText,然后检查弹出窗口并查看它确实就在 下方body)。
Edit: the problem was that in my project, I was using angular-ui 0.1.0 instead of angular-ui 0.4.0
编辑:问题是在我的项目中,我使用的是 angular-ui 0.1.0 而不是 angular-ui 0.4.0

