I created a page using AngularJS.
$scope.search = function (item) {
if ($scope.searchText == undefined) {
return true;
}
else {
if (item.city.toLowerCase().indexOf($scope.searchText.toLowerCase()) != -1 || item.name.toLowerCase().indexOf($scope.searchText.toLowerCase()) != -1)
{
return true;
}
}
return false;
}
Link : http://plnkr.co/edit/sDtDyKDw2pPJC5Ww05W4?p=preview
The program runs fine. I set a debugger in the console and checked the function and found that the search function in the script is called twice for each (ng-repeat)item. i.e. 10 times in total. What is the reason that it goes around again?