One of the main components in my structure is an
<img ng-repeat="img in api.images" src="{{ img.url }}">
The api
object contains a list of image IDs and needs to make HTTP calls to retrieve the URLs for each image ID from the server. However, these URLs are protected with an HMAC Signature that expires, resulting in a different signature being generated every time a request is made. This means that the api.get_image_urls
function will always return different results when called.
get_image_urls: function() {
var deferred = $q.defer();
var that = this;
$http.post(this.url + "image_urls/", {
"image_ids": Object.keys(this.images)
})
.success(function(data) {
for (var image_id in data.images) {
that.images[image_id].url = data.images[image_id];
}
deferred.resolve();
});
return deferred.promise;
}
This can lead to an infinite digest loop as the URLs change constantly. What would be the most effective approach to prevent this issue?