Typically, when I want to retrieve data asynchronously, I would use the following approach:
var promise = $http.get('/api/v1/movies/avengers');
promise.then(
function(payload) {
$scope.movieContent = payload;
});
This scenario is quite common - sending a request and assigning everything it returns to a variable or property once it's ready. However, it always requires a callback, even if the callback remains the same every time.
Is there a way to achieve something like this instead?
$scope.movieContent = $http.get('/api/v1/movies/avengers'); // updates with real value once request is complete
Or perhaps something similar to:
updateWhenReady($scope.movieContent , '/api/v1/movies/avengers');
It may seem minor, but in my opinion, it can make a difference when used frequently.