简体   繁体   English

如何给Angular JS Auto Complete固定高度?

[英]How to give fixed height for Angular JS Auto Complete?

ng2-auto-complete result goes lengthy. ng2-auto-complete结果冗长。 If I try to inspect and give some css, when a click is done, results are gone. 如果我尝试检查并给出一些CSS,单击完成后结果就消失了。 Then I tried one sample like below, 然后,我尝试了如下所示的一个示例,

ng2-auto-complete{
height: 400px; 
overflow-y: scroll; 
overflow-x: hidden;   
}

I think it's working for me, but a scroll was always in the mentioned height. 我认为它对我有用,但是滚动始终处于上述高度。 How to solve this bug. 如何解决这个错误。 Are there any other methods? 还有其他方法吗?

Check out the below result, that scroll was always there. 检查以下结果,该滚动始终存在。

Check the image below 查看下面的图片

在此处输入图片说明

Check the Code below 检查下面的代码

<div _ngcontent-c14="" class="form-group">
    <label _ngcontent-c14="">Language
        <span _ngcontent-c14="" class="required">*</span>
    </label>
    <div _ngcontent-c14="">
    <div class="ng2-auto-complete-wrapper" style="position: relative;">
        <input _ngcontent-c14="" class="form-control ng-valid ng-touched ng-dirty" display-property-name="TextField" name="ng2autoLanguage" ng2-auto-complete="" placeholder="Enter your language" value-property-name="ValueField" ng-reflect-klass="form-control" ng-reflect-ng-class="" ng-reflect-name="ng2autoLanguage" ng-reflect-source="function () { [native code] }" ng-reflect-display-property-name="TextField" ng-reflect-list-formatter="function (data) {
           " ng-reflect-model="" ng-reflect-ng-model="">
         </div>
    </div>
</div>

Try using max-height : 尝试使用max-height

ng2-auto-complete {
    max-height: 400px; 
    overflow-y: scroll; 
    overflow-x: hidden;   
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM