Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Depending on user input I need to make API calls which then returns me JSON Data.

$scope.citys = [];    
$http.get($scope.apiURL+newCity).then(function(response) {
            $scope.citys.push(response.data);
});

So after lets say two such requests I have a bunch of JSON data in my citys array.

When I try to access it however I receive nothing :(

<ul>
        <li ng-repeat="data in citys">{{citys.data.city.name}}</li>
</ul>

Can someone point me in the right direction, regarding what I am doing wrong? Thanks.

share|improve this question
2  
{{citys.data.city.name}} should be {{data.city.name}} i think. –  Chandermani Jun 2 at 12:00
    
Yep. You're right. I only just saw it :) Thanks. –  sarovarc Jun 2 at 12:05

1 Answer 1

As suggested in the comments: {{citys.data.city.name}} should be {{data.city.name}}

Since your using ng-repeat="data in citys", angular will loop through 'citys' assigning each value to 'data'.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.