私はSpringブートに基づいてフロントエンドにデータを提供するバックエンドを実装しました。それはうまく動作します。 http://localhost:4983/employee/ALL/AngularJS httpsが応答しますが、表示されませんでした
応答::私はローカルホストを参照するためにクロムを使用する場合、それは URL作品
'[{"id":1,"name":"ALFRED","dept":"871m","email":"[email protected]","salary":120000},
{"id":2,"name":"FRANK","dept":"TCTO","email":"[email protected]","salary":920000},
{"id":3,"name":"NANCY","dept":"TDSB","email":"[email protected]","salary":620000},
{"id":4,"name":"TONG","dept":"NYGH","email":"[email protected]","salary":720000},
{"id":5,"name":"CINDY","dept":"University Of Victoria","email":"[email protected]","salary":9987654},
{"id":6,"name":"CINDY HUANG","dept":"University Of Victoria","email":"[email protected]","salary":9987654}]'
をしかし、私は$ HTTPにHTMLや角度JSを使用する場合、予想通り、データは表示されませんでした。ここで
私の角度JSコードです:
<html>
<head>
<title>Angular JS Includes</title>
<style>
table, th, td {
border: 1px solid grey;
border-collapse: collapse;
padding: 5px;
}
table tr:nth-child(odd) {
background-color: #f2f2f2;
}
table tr:nth-child(even) {
background-color: #ffffff;
}
</style>
</head>
<body>
<script>
function employeeController($scope, $http) {
$http({method: 'GET', url: 'http://localhost:4983/employee/ALL/'})
\t \t .success(function (response) {
\t \t $scope.employees = response;
console.log($scope.employees);
$scope.context = "IT works";
\t \t });
}
</script>
<h2>AngularJS Employee Application</h2>
<div ng-app="" ng-controller="employeeController">
{{ context }}
{{ employees[0].id }}
<table>
<tr>
<th>Employee ID</th>
<th>Employee Name</th>
<th>Employee Dept</th>
<th>employee Email</th>
\t \t <th>employee Salary</th>
\t \t <th>{{ msg }}</th>
</tr>
<tr ng-repeat="empl in employees">
<td>{{ empl.id }}</td>
<td>{{ empl.name }}</td>
<td>{{ empl.dept }}</td>
<td>{{ empl.email }}</td>
<td>{{ empl.salary }}</td>
\t \t <td>{{ msg }}</td>
</tr>
</table>
</div>
{{ msg }}
<script src='http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js'></script>
</body>
</html>
私はChromeで、このページを参照すると、私はバックエンドスプリングブートと呼ばれるデータで応答してきた見ることができます。しかし、フロントエンドはそれを表示しません。誰かが私が間違ったことを見ることができますか? {|オブジェクト列} - - 変換関数を用いて形質転換応答本体
データ:
ここでモジュールを定義しましたか? –
ブラウザのコンソールでエラーをチェックしましたか?またはログの値? –