I am currently using a filter function (not a custom filter) on ng-repeat. However I have been told that using a custom filter is better performance. How would I go about using a custom filter to do the same search as this:
$scope.searchInOrder = function (item)
{
if($scope.search)
{
if(item.match("^"+$scope.search, "i"))
{
return item;
}
}
else
{
return item;
}
}
Here is my fiddle.
So I use this filter using "key in keyboard.keys | filter: searchInOrder" but how do I do the same thing using a custom filter e.g. "key in keyboard.keys | customSearchInOrder:search" is it better for performance doing it this way (with a custom filter instead of a function) and if so why? Also which way is better for code maintainability?