0
我想基于另一个阵列的结果得到一个数组:使用承诺内解决承诺
for (var i = 0; i < result.data.ftListes.length; i++) {
//Get the name of the task related to the timesheet
tachesPromises.push(Tache.getTachebyId(result.data.ftListes[i].tacheid));
// I tried to get the project here but it didn't work
}
//resolve promises
$q.all(tachesPromises).then(function(taches) {
taches.forEach(function(el) {
tasks.push(el.data.tachelistes);
projetsPromises.push(Projet.getProjetbyId(el.data.tachelistes.projet_id));
});
});
$q.all(projetsPromises).then(function(p) {
p.forEach(function(el) {
projet.push(el.data.projetsListe);
});
});
看来,我的GET请求工作,但我没有看到结果
请求帮助时,请缩进并合理地格式化您的代码。图沙尔在这个场合为你做了。 –