$ scope.greetingはnullです: [{ "ID":1、 "名前" これはデータである http://localhost:8081/PetStoreSpringRest/rest/empsgreeting.idがnullであるか、私はRESTfulなWebサービスをテストし、それはデータがある
: "created"、 "createdDate":1484969286677}
Google Chromeのデバッグを使用すると、応答の値がわかります。データ しかし、window.alert($ scope.greeting.id);私はgreeting.idにNULLがあり、$ scope.greeting.idである理由、それはIDがあり、この
のヌル
結果を表示{{greeting.idが}}
が あるIDは必ずされていませんヌル
\t \t \t \t <!doctype html>
\t \t \t \t <html ng-app="demo">
\t \t \t \t \t <head>
\t \t \t \t \t \t <title>Hello AngularJS</title>
\t \t \t \t \t \t <script src="libs/angular.js"></script>
\t \t \t \t
\t \t \t \t \t <script>
\t \t \t \t \t /*
\t \t \t \t \t {"id":60,"content":"Hello, World!"}
\t \t \t \t \t http://localhost:8081/PetStoreSpringRest/rest/emps
\t \t \t \t \t [{"id":1,"name":"Albert Lam","createdDate":1484969286677},{"id":2,"name":"John John","createdDate":1484969286677}]
\t \t \t \t \t */
\t \t \t \t \t angular.module('demo', [])
\t \t \t \t \t .controller('Hello', function($scope, $http) {
\t \t \t \t \t $http.get('http://localhost:8081/PetStoreSpringRest/rest/emps').
\t \t \t \t \t \t then(function(response) {
\t \t \t \t \t \t $scope.greeting = response.data;
\t \t \t \t \t \t window.alert($scope.greeting.id);
\t \t \t \t \t \t });
\t \t \t \t \t });
\t \t \t \t \t </script>
\t \t \t \t \t </head>
\t \t \t \t \t <body>
\t \t \t \t \t \t <div ng-controller="Hello">
\t \t \t \t \t \t \t <p>The ID is {{greeting.id}}</p>
\t \t \t \t \t \t \t
\t \t \t \t \t \t \t
\t \t \t \t \t \t \t
\t \t \t \t \t \t </div>
\t \t \t \t \t </body>
\t \t \t \t </html>