【发布时间】:2014-10-14 20:32:47
【问题描述】:
我正在尝试从多个来源加载数据,并且希望仅在加载所有数据后继续处理。这是我的代码:
var tables = [];
$http
.get('/tables')
.then(function (response) {
_.each(response.data, function (table) {
tables.push(table);
});
})
// get detail data
.then(function () {
_.each(tables, function (table) {
$http.get('/tables/' + table)
.success(function (data) {
process(data);
});
});
})
.then(function () {
// after everything loaded
// run this function
});
感谢您的帮助!
【问题讨论】:
标签: javascript underscore.js promise angular-promise