I have created a plunkr here: http://plnkr.co/edit/wPCex3lJc5E0I4fSeXI1?p=preview
The application should allow the user to perform a search, and return results.
I have got to the point where the number of correct results are shown (if just a country is selected), but i cant seem to pass the whole matching object in my for loop.
HTML:
<div ng-repeat="myresults in Results track by $index"> {{myresults}} </div> JS:
$scope.Results = []; $scope.search = function(country, city, department) { var countryValue = country.Country; for (i = 0; i < $scope.Data.length; i++) { if ($scope.Data[i].Country == countryValue) { $scope.Results.push(countryValue); } } console.log($scope.Results); }