Freya Freya - 3 months ago 9x
JSON Question

Response not displayed in the view (nodejs, mysql, angularjs)

I am trying to populate a basic angular app with data from a database. Example similar to that in w3schools. This is the code so far:

<div ng-app="myApp" ng-controller="customersCtrl">

<tr ng-repeat="x in names">
<td>{{ }}</td>
<td>{{ x.appid }}</td>

var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
.then(function (response) {$scope.names =;});

However, no data are retrieved. The response i get from http://localhost:3000/test is the following:




I checked it both from the browser and from postman. If I replace with the response above, the table displays the values in the response.

I know I must be messing something up, but somehow I am missing it. My best guess would be that of the format of the response.


You need to remove .records from the

        .then(function (response) {$scope.names =;}); 

Since you are directly receiving an array just assign array from response directly to $scope.names.