[英]Angular-UI typeahead directive does not drop down
I am using AngularUI typeahead directive. 我使用AngularUI 预输入指令。 Data-wise everything works fine; 从数据角度看,一切正常。 however, the dropbox is cut vertically, and a scrollbar shows up on the right. 但是,下拉框是垂直切开的,右侧会显示一个滚动条。 The image below shows what I mean. 下图显示了我的意思。 If I scroll down, I see all the values in the typeahead dropbox that I expect. 如果向下滚动,则会在预想输入框中看到所有期望的值。
I tinkered with the styles and I see that .dropdown-menu style from AngularUI is defined as position: absolute;
我修改了样式,然后看到AngularUI的.dropdown-menu样式定义为position: absolute;
If I change it to position: static;
如果我将其更改为position: static;
the dropdown shows at full height; 下拉列表显示为全高; however, if I have a button below the input field - it shows to the right of the dropdown, instead of being overlayed by it. 但是,如果我在输入字段下方有一个按钮-它显示在下拉菜单的右侧,而不是被其覆盖。 Again, a picture is worth a thousand words. 同样,一张图片值得一千个字。
There are some styles at the "master page" level; 在“母版页”级别有一些样式; but I have no idea what exactly causes such behavior. 但我不知道是什么原因导致了这种行为。 Clearly, I am running out of my CSS/Web design skills. 显然,我用完了CSS / Web设计技能。
The problem is that your container has overflow: hidden
and of course it will cut typeahead's dropdown. 问题是您的容器已overflow: hidden
并且当然会减少typeahead的下拉菜单。 In such cases you need to tell typeahead to append dropdown container to another parent container, typically body
. 在这种情况下,您需要告诉typeahead将下拉容器附加到另一个父容器(通常是body
。 For this you use additional config attribute typeahead-append-to-body
. 为此,请使用其他配置属性typeahead-append-to-body
。 Something like this: 像这样:
<input type="text"
ng-model="selected"
uib-typeahead="state for state in states | filter:$viewValue | limitTo:8"
typeahead-append-to-body="true">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.