I am in the process of developing a simple webpage that displays data retrieved from
http://rest-service.guides.spring.io/greeting
.
The JSON output looks like this:
{"id":2273,"content":"Hello, World!"}
This is the HTML code I am using:
<body ng-app="hello">
<div class="container">
<h1>Greeting</h1>
<div ng-controller="home" ng-cloak class="ng-cloak">
<p>The Id is: {{greeting.id}}</p>
<p>The content is: {{greeting.content}}</p>
</div>
</div>
<script src="js/angular-bootstrap.js" type="text/javascript"></script>
<script src="js/hello.js"></script>
</body>
And here is the hello.js file:
var myApp = angular.module('hello', []);
myApp.controller('home', ['$scope', function($scope) {
$scope.greeting = {};
$http.get('http://rest-service.guides.spring.io/greeting')
.success(function(data, status, headers, config) {
$scope.greeting = data;
});
}]);
Issue: the placeholders greeting.id/content
are not getting resolved. What could be causing this problem?