Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript angularjs:如何在选择下拉列表中使用滚动条_Javascript_Angularjs - Fatal编程技术网

Javascript angularjs:如何在选择下拉列表中使用滚动条

Javascript angularjs:如何在选择下拉列表中使用滚动条,javascript,angularjs,Javascript,Angularjs,我在fileNameLists中有一个很长的项目列表,我只希望在选择选项中有一个可滚动的下拉列表。(最多显示5个项目,如果有更多项目,可以滚动显示) 我的代码: <select name="fileNameSelected" class="form-control" title="Select File Name" ng-model="fileName"

我在
fileNameLists
中有一个很长的项目列表,我只希望在选择选项中有一个可滚动的下拉列表。(最多显示5个项目,如果有更多项目,可以滚动显示)

我的代码:

<select name="fileNameSelected"
                    class="form-control"
                    title="Select File Name"
                    ng-model="fileName"
                    ng-change=""
                    selectpicker=""
                    ng-options="item as item for item in fileNameLists ">
            </select> 

我试图在选择部分中添加
style=“max height:30px;overflow-y:scroll;”
,但不起作用

有什么想法吗


谢谢

将另一个类添加到您的选择中

<select name="fileNameSelected"
                class="form-control select"
                title="Select File Name"
                ng-model="fileName"
                ng-change=""
                selectpicker=""
                ng-options="item as item for item in fileNameLists ">
</select>

可以。

将另一个类添加到您的选择中

<select name="fileNameSelected"
                class="form-control select"
                title="Select File Name"
                ng-model="fileName"
                ng-change=""
                selectpicker=""
                ng-options="item as item for item in fileNameLists ">
</select>

可以。

我会说添加更多的描述,这将有助于理解您的代码嗨,那么我必须在CSS中添加它吗?我可以用HTML吗?你可以将它添加到css中,也可以直接添加到你的元素中,就像你在评论中提到的那样。@AniruddhaDas按照建议修复了它。实际上,它将帮助所有人寻找这个答案。:)我会说,添加一些更多的描述,这将有助于理解您的代码嗨,那么我必须添加在CSS?我可以用HTML吗?你可以将它添加到css中,也可以直接添加到你的元素中,就像你在评论中提到的那样。@AniruddhaDas按照建议修复了它。实际上,它将帮助所有人寻找这个答案。:)尝试将size=“5”添加到select tagI did但不起作用尝试将size=“5”添加到select tagI did但不起作用