现在我想用函数“getPresentationFilterValues”与filterItem绑定响应的数据。 在使用promise调用回调函数时,如何获取过滤器Item的数据?以下是代码。
$q.all(presentationPromiseList).then(
function(response){
for(var i=0; i<response.length; i++){
config = self.bindAppPresentation(response[i], {config:config});
var filtering = config.configuration.filtering;
for(var i = 0; i< filtering.length; i++){
for(var j = 0; j < filtering[i].filters.length; j++){
var filterItem = filtering[i].filters[j];
if(filterItem.source == 'dynamic'&& !filterItem.options){
responsePromise = reveal.getPresentationFilterValues(filterItem);
responsePromise.then(function(response){
}).catch(function(ex){});
}
}
}
}
console.log("App presentation bind");
return 'param1';
},
function(response){
return $q.reject(new Error("failed to get app presentation: " + response.data.message));
}
)
答案 0 :(得分:0)
这样的事情:
const outsideData = 1
someFunctionWhichReturnsPromise().then(function() { return outsideData })