【问题标题】:filter object doesnt work angularjs过滤器对象不起作用
【发布时间】:2014-03-13 10:40:33
【问题描述】:

我正在使用 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">

【问题讨论】:

    标签: angularjs api restangular


    【解决方案1】:

    如果你想运行两个过滤器,你必须把两个都通过管道:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-03
      • 2017-06-23
      • 2021-03-21
      • 2011-07-12
      • 2020-01-31
      • 1970-01-01
      • 1970-01-01
      • 2020-05-25
      相关资源
      最近更新 更多