考虑下面的伪代码:角 - 转换功能为一个承诺
// main
function1();
function2();
...
//the rest of the code
....
// function1:
someservice.getPhone().then(calback1);
// function2:
someservice.getAddress().then(calback2);
我能做些什么,以确保代码的其余部分是不是直到两个功能1执行,函数2获得直通其回调?
由于
如果你想等待几个承诺 - 使用$ q.all –