Just dove into the world of fetching and displaying JSON data in my AngularJS app for the first time, but unfortunately, no data is showing up. Here's the code I have implemented:
HTML
<div ng-app="myApp" ng-controller="customersCtrl">
<table>
<td>{{ x.id }}</td>
<td>{{ x.title }}</td>
</table>
</div>
</body>
</html>
Script
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("http://example.com/api/get_page_index/")
.then(function (response) {$scope.names = response.data.pages;});
});
</script>
JSON Content Retrieved from URL
{
"status": "ok",
"pages": [
{
"id": 2,
"type": "page",
"slug": "sample-page",
"url": "http:\/\/example.com\/",
"status": "publish",
"title": "example page",
"content": "",
"excerpt": "",
"date": false,
"modified": "2016-08-09 17:28:01",
"comments": [],
"attachments": [],
},