Although this question has been posed multiple times before, none of the solutions seem to be effective for my issue.
Controller
app.controller('HomeController', function ($scope, $timeout, $http) {
$scope.eventData = {
heading: "",
description: ""
};
$http.get("/GetEvents")
.then(function (response) {
$scope.eventData.heading = response.data.heading;
$scope.eventData.description = response.data.description;
console.log($scope.eventData);
},
function (error) {
console.log(error);
});
});
HTML
<div>
<h3>{{eventData.heading}}</h3>
<p>{{eventData.description}</p>
</div>
Upon refreshing the page, the values for description and heading sometimes do not appear. It seems like they are set to empty strings. This inconsistency is puzzling as the console consistently displays the correct values.
Note* jQuery is also included in the setup.