Hello I'm trying to read a JSON via http using AngularJS (I need to use AngularJS) and I can not even display the first JSON data since it does not have a string that I can call in function (response) in $ scope.countries = response. ? I do not know how to call the data if it does not have a string.
I can not change the JSON data since they come from a base that I can not edit and can not read incorporating data directly into js, it has to come from http.
My js and html:
var app = angular.module('MyApp', []);
app.controller('ArqCtrl', function($scope, $http) {
$http.get("https://endereco.json").success(function(response) {
$scope.countries = response.'' ;
});
});
<!DOCTYPE html>
<html ng-app="MyApp">
<head>
<meta charset="utf-8">
<title>Test for archive</title>
</head>
<body>
<div ng-controller="ArqCtrl">
<ul>
<li ng-repeat="country in countries">
{{ country.name + ',' + country.capital + ',' + country.bd + ',' + country.pop }}
</li>
</ul>
</div>
</body>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script><scriptsrc="script.js"></script>
</html>
The JSON that is in the address has the data:
[{"name":"United States","capital":"Washington, D.C.","pop":321645000,"latlng":[38.0,-97.0],"bd":["CAN","MEX"]}]
If someone can help, thank you