1:在页面使用Filter
question 对象属性值:id、no、title、name、type、busCode、productCode
questionList 为question 对象集合
<ul>
<li ng-repeat="q in questionList | filter : {'q.name' : A}">
{{ q.no + ', ' + q.name }}
</li>
</ul>
<!--------------select------------------->
<select
ng-option="q.no as q.name for q in questionList | filter : {'q.busCode' : A,'q.productCode' : B}">
<option>请选择</option>
</select>
注意上述的 A和B 可以是页面别的地方的ng-model 绑定的值。也可以是后台返回的model值
2:JS中处理过滤
<select
ng-option="q.no as q.name for q in questionList ">
<option>请选择</option>
</select>
js中过滤,busCode、productCode 为list中对象的属性,$scope.A,$scope.B 为对应需要过滤的内容。(模糊查询)
$scope.questionList = $filter('filter')($scope.questionList,{'busCode' : $scope.A,'productCode' : $scope.B})