PFB the code of my custom filter where it takes a parameter viewbookoption which is a dropdown value.
Based on the dropdown value,the data will be shown in the grid.I implemented forEach loop here but it is not working properly and it keeps traversing the loop and gives me close to 10000 records but actually I have only 10 records which should be displayed in the grid.
Any help in this regard will be much appreciated.
Controllers.filter('filterUnissued', function() {
return function(books, viewbookoption) {
if (viewbookoption == "All Books") {
return books;
} else {
angular.forEach(books, function(book) {
if (book.issued == false) {
books.push(book);
}
});
}
return books;
}
});