I read in some questions here, that you shouldn't change the data inside the filter. Now my problem is that the API I am using doesn't support a query to filter the data from the server. My only option is to load everthing and filter it inside my App.
My approach was to write a custom filter, which filters the already downloaded data and then downloads the next 100 entries (another limitation of the API). This will be repeated until everything is downloaded.
Example Data
"name": entry.name,
"thumb": entry.thumbnail,
"date": entry.date,
"hide": false
Example Code (I know the filter wouldn't work that way, but since I think the entire approach is wrong, it doesn't matter for now)
customMod.filter('CustomFilter', function(entry){
entry.hide = (entry.name.indexOf("bla") === -1);
loadNewDataAndAddToEntries();
})
View
<div data-ng-repeat="entry in entries | CustomFilter" data-ng-class="{true:'hide'}[entry.hide]">...</div>
What would be a better or the correct approach to do this?