I am trying to learn angularjs, and have hit a block in trying to databind to an array returned from a Rest API. I have a simple azure api returning an array of person objec
The array you get back from the server isn't a clean array, but has some extra properties. That makes ng-repeat not show anything when you iterate over it using in.
You need a special iterator to go over the array from the server, which will ignore those extra properties. So extract the array data through forEach first, like this:
$scope.items = []
var response = $scope.svc.get();
angular.forEach(response, function(item) {
$scope.items.push(item);
});
Then you can do
- 热议问题