0
這裏被應用在 數據檢索由角JS使用REST Web服務是不是happing
<div class="container" data-ng-app="myApp" ng-controller="hController">
<li ng-repeat="x in names">
{{ x.Name + ', ' + x.Country }}
</li>
</ul>
控制器實現
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("http://localhost:8080/rest/hotel")
.success(function(response) {$scope.names = response.records;});
});
</script>
</head>
錯誤的代碼段,我可以在Web控制檯看到
錯誤:[ng:areq] http://errors.angularjs.org/1.3.14/ng/areq?p0=hotelController&p1=not%20a%20function%2C%20got%20undefined at Error(native) at http://localhost:8080/resources/js/angular.min.js:6:417
我路徑已經添加angular.min.js
控制器的名稱是customersCtrl,更改ng-controller – Sajal