If I have an event type; say a click event. That I want to fire 3 unique ajax requests for but I want to subscribe to the final result of all 3 requests
What is the proper design pattern for this sequence.
My current code block looks something like this
$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;
});