您应该将$ http.get放入控制器中。
而且,Web服务返回的对象不是数组。因此,您的ng-repeat应该是这样的:
book in data.books
这是一个工作示例:
var app = angular.module('booksInventoryApp', []);app.controller('booksCtrl', function($scope, $http) { $http.get("https://whispering-woodland-9020.herokuapp.com/getAllBooks") .then(function(response) { $scope.data = response.data; });});<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script><article ng-app="booksInventoryApp"> <section ng-controller="booksCtrl"> <h2 ng-repeat="book in data.books">{{book.name}}</h2> </section></article>


