1
ngTagInputを使用するng-table用のカスタムフィルタを実装しました。 Link [1]は私のコードと似ていますが、このフィルタは現在のページでのみ動作します。 ng-repeatでフィルタリングされるすべての結果を取得する正しい方法は何ですか?ng-table、ng-repeat、フィルタは現在のページ、ページテーブル内でのみ動作します
フィルタ用のコードスニペット:
.filter('filterByTags', function() {
return function (items, tags) {
var i = 0;
var filtered = []; // Put here only items that match
(items || []).forEach(function (item) { // Check each item
var matches = tags.some(function (tag) { // If there is some tag
i++;
return (item.name.indexOf(tag.name) > -1) // that is a substring
}); // we have a match
if (matches) { // If it matches
filtered.push(item); // put it into the `filtered` array
}
});
if(i == 0){
return items;
}
else{
return filtered;
}
};
})
[1] Filter ngtagsinput in AngularJS