0
我想通過條形碼過濾我的庫存,我可以這樣做嗎?這裏的要點是,如果條形碼我傳遞的是等於庫存[i]條形碼(在服務器中),則將$scope.inventories
更改爲僅限條形碼匹配的條形碼。然後$ scope.inventories只包含匹配的條形碼庫存。過濾器對象數據angularjs
有一些瘋狂的錯誤。任何幫助,如何過濾對象數據?
$scope.inventories = new Inventory().query().$object;
$scope.filter = function(barcode) {
for(var i = 0; i < $scope.inventories.length; i++){
if($scope.inventories[i].barcode == barcode){
$scope.inventories = $scope.inventories[i];
}
}
};
模板
<ul ng-repeat="inventory in inventories">
<li><a href="" ng-click="filter(inventory.barcode)">{{inventory.barcode}}</a></li>
</ul>
也許你可以幫我一把嗎? http://stackoverflow.com/questions/22712486/filter-objects-matching-details – Erick