As I delve into tutorials on utilizing an API with AngularJS, I'm encountering some issues when trying to display {{greeting.id}}
and {{greeting.content}}
. Despite my expectations, the results are not showing up on my screen.
Here is the link to my CodePen: http://codepen.io/ChaseHardin/pen/bprObb/
Any idea why the id and content are not visible on the UI? Could it be a problem with my HTML or JavaScript code?
HTML
<html>
<head>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.9/angular.min.js"></script>
</head>
<body ng-app="myApp">
<div ng-controller="GreetingController" class="container">
<h1>Greeting</h1>
<hr/>
<div ng-repeat="greeting in greetings" class="col-md-6">
<h4>{{greeting.id}}</h4>
<p>{{greeting.content}}</p>
</div>
</div>
</body>
</html>
JavaScript
var myApp = angular.module('myApp', []);
myApp.controller("GreetingController", function ($scope, $http) {
$http.get('http://rest-service.guides.spring.io/greeting').
success(function (data) {
$scope.greeting = data;
});
});