0

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); } 

1 Answer 1

1

You are only pushing the country name in $scope.Results, push the whole data object instead:

$scope.Results.push($scope.Data[i]);

http://plnkr.co/edit/DH8DBUKoWKITIyaEH1yD?p=preview

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.