0
所有解決數據我檢查如何讓所有的解決數據在$。當(NULL,promArr)
我正在裏面那麼最後解析數據。但我需要得到整個解決的東西。
var _promArr = [],_prom = '';
_.each(uniqueAccountList, function(obj,idx){
_prom = getAccountDetails(obj.acctId);
_promArr.push(_prom);
});
$.when.apply(null, _promArr).then(function(){
***I need all data passed inside resolve here***
}).always(function() {
console.log('all joint promises resolved always');
});
function getAccountDetails(accid){
// perform ajaxcall and resolve or reject the promise
var _def = $.Deferred();
if (successs)
_def.resolve({accid:accid,status:1})
else if (fail.reason == 'Not found')
_def.resolve({accid:accid,status:0})
else
_def.reject();
return _def
}