I've been stuck for some time now trying to display JSON data in a table with AngularJS 1.6.9.
Here is my index.html:
<!DOCTYPE html>
<head>
<title>Een eenvoudige service</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<script src="service.js"></script>
<link rel="stylesheet" href="style.css">
<script>
</script>
</head>
<div ng-app="mijnApp" ng-controller="mijnController">
<table>
<tr>
<th>ID</th>
<th>City</th>
<th>Country</th>
</tr>
<tr ng-repeat="x in personen">
<td>{{x.Name}}</td>
<td>{{x.City}}</td>
<td>{{x.Country}}</td>
</tr>
</table>
</div>
</body>
</html>
Here is my JavaScript:
var App = angular.module('mijnApp', []);
App.controller('mijnController', function($scope, $http) {
$http.get("personen.json").then(function(response) {
$scope.personen = response.data;
});
});
Small example of my json file:
{
"records": [{
"Name": "Alfreds Futterkiste",
"City": "Berlin",
"Country": "Germany"
}, {
"Name": "Ana Trujillo Emparedados y helados",
"City": "México D.F.",
"Country": "Mexico"
}]
}
I've tried multiple methods and the result is always the same - empty table.
How can I resolved this issue? Please help me for the same issue.
"records"-><tr ng-repeat="x in personen.records">