【发布时间】:2016-10-05 04:21:36
【问题描述】:
我正在尝试按一列或多列过滤表格。
问题在于表中的某些行并不包含所有字段,因为它们可能为空。
然后,在我进行任何搜索之前,只显示具有所有数据字段的行,“ng-repeat”不会显示这些行。
我的 HTML 代码:
<input ng-show="combo.num == 0" type="text" class="form-control" ng-model="searchUS.$"/>
<input ng-show="combo.num == 1" type="text" class="form-control" ng-model="searchUS.subject"/>
<input ng-show="combo.num == 2" type="text" class="form-control" ng-model="searchUS.status"/>
<input ng-show="combo.num == 3" type="text" class="form-control" ng-model="searchUS.tags"/>
<tr ng-repeat="row in rowCollectionUserStories
| orderBy:sortType:sortReverse |filter:searchUS"
ng-class="row.selectedCell ? 'cellSelectedClass' : ''">
我也尝试将 ng-model = "searchUS.$" 更改为 "searchUS",但我将输入作为占位符 [object] [object]。
在此示例中,它完美运行:link。
我更改了删除数字字段的数组,它可以工作。
在我的情况下,该字段可能为空是一个数组,这就是问题所在。
有什么想法吗?
非常感谢。
【问题讨论】:
-
错误的示例链接?
-
是的,链接错误。已经更正了。
标签: javascript angularjs angularjs-filter