过滤器对象不起作用angularjs

时间:2014-03-13 10:40:34

标签: angularjs api restangular

我正在使用Restangularjs,我想过滤我的数据,但它不起作用。我想那是因为我找回了物品。我该怎么办?

 app.controller('InventoryListCtrl', function($scope, Inventory, User, Tags, Restangular, inventoryItems) {
        $scope.inventories = inventoryItems;
        $scope.tags = new Tags().query().$object;
        $scope.users = new User().query().$object;
    });

我的配置状态

app.config(function config( $stateProvider, $urlRouterProvider) {
$stateProvider.state('inventory',{
url:'/inventory',
    views: {
        "main": {
            controller: 'InventoryCtrl',
            templateUrl: 'inventory/main.tpl.html'
        }
    },
    data:{ pageTitle: 'Inventory' }
}
).state('inventory.listview',{
url:'/listview',
    views: {
        "listview": {
            controller: 'InventoryListCtrl',
            templateUrl: 'inventory/inventory.listview.tpl.html'
        }
    },
    data:{ pageTitle: 'Listview' },
    resolve: {
        inventoryItems: function(Inventory){
            return new Inventory().query();
        }
    }
});
});

我无法过滤我的数据

<select ng-model="inventory.model" ng-options="inventory.model for inventory in inventories">
     <option value="">Model</option>
</select> 

<tr ng-repeat="inventory in inventories  | filter: search  filter| inventory.model">

1 个答案:

答案 0 :(得分:0)

如果要运行两个过滤器,则必须将两个过滤器放在一起:

<tr ng-repeat="inventory in inventories  | filter: search | filter: inventory.model">