Like the title says, what is the best approach to filter a list of ng-repeat
? To use a custom (or existing) .filter()
or to create a custom filter function inside my controller?
The reason why I'm asking it is because the .filter()
is called multiple times (everytime there is a dygest cycle according to this answer).
So I'm concerned about performance issue. If I have a huge list to use inside the ng-repeat and need to filter it, isn't it going to take a huge impact when using .filter()
?
On the other hand, when using a custom filter function inside a controller I'll only filter the list when it's needed and only once. I have a better control over this part.
Is this a correct logic? Or is there any other way to optimize the use of filters?