mardi 30 septembre 2014

Filter Results in AngularJS


Vote count:

0




I have ng-click in my view, which is supposed to filter my presented results.



<a role="menuitem" tabindex="-1" href ng-click="itemFilter=itemABCFilter">ABC Filter</a>


All items from ABC are stored in my controller, such as



$scope.itemABC=["Alpha","Beta","Gamma"];


A list of all items in my view come from a $http request I made. No I seek loop through all data.item (my data I obtained from the get request) and find out whether it contains any element of itemABC or can be considered as a substring of any of the elements of itemABC it.



$scope.itemABCfilter=function(data){
for (var j=0; j<$scope.itemABC.length;j++){
if($scope.itemABC[j].search($scope.data[i].name)>-1) return true;
}


Somehow the code above does not filter my results. Do I handle the $http request results not correctly or is the code simply wrong? How would ou do it?


Thanks



asked 1 min ago







Filter Results in AngularJS

Aucun commentaire:

Enregistrer un commentaire