如果我有一个事件类型;说一个点击事件。我想触发 3 个唯一的 ajax 请求,但我想订阅所有 3 个请求的最终结果
这个序列的正确设计模式是什么。
我当前的代码块看起来像这样
$rootScope.$eventToObservable('selectUser')
.throttle(500)
.map(data => {
return angular.copy(data.additionalArguments[0].entity);
})
.select(d => {
return {
Member: MemberService.getMember(d.ID),
otherData: MemberService.dataOtherData(d.ID),
Notes: MemberService.getNotes(d.ID),
Log: MemberService.getLog(d.ID)
}
})
.switchLatest() //Code current dies here with an object is not a function error. I believe because the return object is not an obserable. But not sure what the proper design pattern is.
.subscribe(model => {
//I would like that model would contain an object with the result of the 3 responses above.
$scope.model = model;
});