I have seen other questions relating to this and implemented the answers to the best of my understanding. But, I am unable to display the response in the view with ng-repeat. Here is my code.
JS file:
app.controller('testcontrol', ['$scope', '$http', function($scope, $http) {
$scope.resultset = [];
$http.get('http://localhost:3000/testdata').then(function(data) {
$scope.resultset = data.data.resultset;
console.log($scope.resultset);
},function(error) {
$scope.error = error;
})
}]);
HTML:
<div class="wrapper-md" ng-controller="testcontrol">
<ul>
<li data-ng-repeat="result in resultset">
{{result.name}}
</li>
</ul>
</div>
I am able to see the data in console. But, I am unable to see produce this in the view. I do not see why not. I am using the promise as well as initialized the variable so that ng-repeat would not choke.
Console response:
[Object, Object, Object, Object, Object]
0: Object
avatar: "img/a4.jpg"
followers: "2104"
name: "Chris Fox"
title: "Master Chef"
url: "#"
__proto__: Object
1: Object
2: Object
3: Object
4: Object
length: 5
__proto__: Array[0]