我是AngularJS的新手,我試圖使用REST api URL獲取數據,並試圖將URL傳遞給angularjs並在HTML中顯示數據。但它顯示內部服務器錯誤。請找出錯誤的屏幕截圖和休息URL數據在AngularJS中傳遞的Java REST API URL不起作用
這裏是我的HTML,
<html ng-app="myApp" ng-controller="myCtrl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js">
</script>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
$http({
method: "GET",
url: "http://localhost:8080/WebApplication1/webresources/rest.employee/Show/1"
}).then(function mySucces(response) {
$scope.myWelcome = response.data;
}, function myError(response) {
$scope.myWelcome = response.statusText;
});
});
</script>
</head>
<body>
{{myWelcome}}
</body>
</html>
什麼樣的錯誤你是在瀏覽器調試器/開發工具的控制檯看到? –
我已經包含了控制檯錯誤的另一個屏幕截圖... – JavaLearner1
然後你應該檢查服務器端發生了什麼 –