angular - forkJoin some observables with name observable function in result?
问题描述
Lets suppose there is array of Observable function:
A(): Observable<any>
B(): Observable<any>
Then using forkJoin I await response from both Observables:
let g = forkJoin([A(), B()]);
After subscription on g
I can get results from both Observables.
Due this question, how to know from which Observable I have got result, I mean A(), or B().
Is it possible to get names or reference to these functions?
More detailed explanation:
I have unknown number of Observable functions. I need to wait them executions, to get response then enable button. So, also I need to handle response in each of them body, or in common body response in forkJoin
解决方案
新的 observable 将解析一个结果数组,这些结果的顺序与forkJoin
g.subscribe([a, b] => {
console.log(a);
console.log(b);
})
请参阅文档中的示例 5
推荐阅读
- javascript - Exif 返回值为 -6
- python - Python pygame如何从玩家射击子弹
- macos - 使 Visual Studio 编辑器不检查 ~ 文件
- reactjs - 如何调用一个函数已经从另一个函数中用于反应
- oracle - Powershell 不能使用数据库视图,除非重新编译
- javascript - 遍历 json 的 groupby 数组
- python - 如何访问 Python DataFrame 中的嵌套 JSON 对象
- html - 如何允许 0-12 之间的数字并且还有其他模式
- asp.net - 如何在 POST 正文中为 asp.net WebAPI POST 路由格式化 XML
- asp.net - 经典的 ASP 连接工作;.Net 失败。为什么?