首页 > 解决方案 > 忽略列表中的空值

问题描述

我正在使用 ng-options 迭代对象列表,并在 UI 组件(下拉选择)中显示列表中的第一个值作为empty值。如何忽略要显示的列表中的空值。

请在下面找到我的代码。另外,我正在我的 JSP 文件中编写此代码。

<select class = "form-control" form-control id = "lenProperty" ng-model = "bank.lendPropertyId"  
 ng-options="lenProperty.id 
                       as lenProperty.lendPropertyName for lenProperty in lenProperties">
</select>

标签: angularjsjsp

解决方案


您可以通过更改创建的方式来忽略空值<select>

 
   <select class = "form-control" id = "lenProperty"  ng-model="bank.lendPropertyId">
    <option ng-repeat="lenProperty in lenProperties" ng-show="lenProperty.lendPropertyName">{{lenProperty.lendPropertyName}}</option>
</select>


推荐阅读