搜索参数需要一个对象。您可以将组合框中的输入存储在
search.id
并从中输入文本
search.quantity
<select ng-model="search.id">
<option ng-repeat="products in listProducts">{{products.id}}</option>
</select>
Quantity:
<input type="text" ng-model="search.quantity">
selectEdit
函数,您将按搜索对象进行筛选。
$scope.selectEdit = function(){
var index = getSelectedIndex($scope.search);
...
}
和
getSelectedIndex
function getSelectedIndex(search){
for(i=0; i<$scope.listProducts.length; i++)
if($scope.listProducts[i].id == search.id && $scope.listProducts[i].quantity == search.quantity)
return i;
return -1;
}
请参阅
plunker