过滤温泉 UI 懒惰重复?
Filter on Onsen UI lazy repeat?
有没有办法在 Onsen UI 惰性重复列表上应用搜索过滤器?
如果我们使用例如<input ng-model="search.$">
我们不能直接应用 | filter:search
因为它不是 ng-repeat。
有什么想法吗?
谢谢。
您需要通过委托对象过滤结果return:
简单示例:
$scope.MyDelegate = {
configureItemScope: function(index, itemScope) {
itemScope.name = $scope.filteredItems[index].name;
},
calculateItemHeight: function(index) {
return 44;
},
countItems: function() {
return $scope.filteredItems.length;
}
};
在此 codepen 中,大量国家/地区列表以这种方式过滤:
http://codepen.io/argelius/pen/VLdGxZ
有没有办法在 Onsen UI 惰性重复列表上应用搜索过滤器?
如果我们使用例如<input ng-model="search.$">
我们不能直接应用 | filter:search
因为它不是 ng-repeat。
有什么想法吗?
谢谢。
您需要通过委托对象过滤结果return:
简单示例:
$scope.MyDelegate = {
configureItemScope: function(index, itemScope) {
itemScope.name = $scope.filteredItems[index].name;
},
calculateItemHeight: function(index) {
return 44;
},
countItems: function() {
return $scope.filteredItems.length;
}
};
在此 codepen 中,大量国家/地区列表以这种方式过滤: http://codepen.io/argelius/pen/VLdGxZ