1
有沒有辦法做到的
$.when.apply([ $.ajax(), $.ajax() ]).done(function(){
// all the ajax's are done now...
})
在AngularJS的$http.get()
承諾制的相同呢?
有沒有辦法做到的
$.when.apply([ $.ajax(), $.ajax() ]).done(function(){
// all the ajax's are done now...
})
在AngularJS的$http.get()
承諾制的相同呢?
我建議你使用$q.all([async1, async2]).then(...)
$q.all([promise, …]) → newPromise
的newPromise將解決一旦所有給定的承諾都得到了解決
查看文檔HERE
@KevinB謝謝,附 –
的問題是,爲什麼你會當你可以將函數的'$ scope'設置爲ajax調用的結果時? – adeneo