I am willing to get a value from $http service in AngularJS and set it inside $scope.listing. Because this is asynchronous action $scope.listing is empty when the page is loaded. I saw some implementations using promise and factory in order to solve it but it feels like an overkill to me. Is there an elegant way to do it?
It looks like that:
$http.get('/getlisting/')
.success(function(response) {
$scope.listing = response;
})
console.log ($scope.listing) // is empty