There is some amount of data. From 1 to tens of thousands of entries. There is a REST API which returns data in a number of 100 pieces. It is necessary using this API to unload everything.
I understand that you need to use promise. But apparently, I'm doing something wrong ...
Here is a sample code:
// Функция которую я вызываю для получения данных var load = function(promise) { return $q(function(resolve, reject) { promise.then(function() { if (data.content.length != 100) { resolve(promiseLoadData(gid, data)); } else { load(promiseLoadData(gid, data)); console.log(data.content.length != data.total.posts); } }); }); }; ... load(promiseLoadData(gid, data)).then(function(data) { console.log(data) });
Data can not be obtained either. Either everything hangs, or I get an empty value.