I have following code:
$scope.getEntriesBySpace = function(space, entryIds){
var entriesHolder = [],
errors = [];
if(entryIds && entryIds.length > 0){
angular.forEach(entryIds, function(entryId){
space.cf_space.getEntry(entryId.trim()).catch(function(error) {
console.log('Could not find entry using access token, Error', error);
return error;
}).then(function(response) {
if(response){
entriesHolder.push(data);
}else{
errors.push({"id": entryId, "message": "Entry not found"});
}
});
});
}
};
i call it like that:
$scope.getEntriesBySpace(sourceSpace, entries);
I want to store every response after each call finished inside the loop and return as array of responses or errors.
Any help is appreciated.
Method getEntry returns promise.
For ref see this library: https://github.com/contentful/contentful-management.js
Thanks