【发布时间】:2018-01-15 17:19:44
【问题描述】:
在我的 Angular 应用程序中。我有大约 6 到 7 个 http 链接请求,执行所有请求需要很长时间。如何优化?
empSvc.getallEmp().then(function (data) {
if (data !== null && data.length > 0) {
repos.saveEmp(data).then(function () {
repos.getemp().then(function (result) {
ctrl.emp= result;
getsubordinates().then(function () {
deleteinactive(data).then(function () {
deleteinactiveSubordinate(ctrl.emp).then(function () {
console.log(success);
});
});
});
});
});
【问题讨论】:
-
请向我们展示您的代码,如果没有固有问题,请尝试代码审查 stackoverflow...
-
请提供minimal reproducible example。也许其中一些可以归为
$q.all() -
@charlietfl- 谢谢,$q.all() 帮助我减少了几秒。
标签: javascript angularjs