【发布时间】:2018-06-01 23:33:50
【问题描述】:
如何重构这些嵌套数组,以便在所有订阅完成后调用某些内容?我确信它与管道、mergeMaps、concatMaps 等的组合有关。
this.teams = [
{
Assignments: [{Id: 0, Name: 'assignment', Notes: 'notes'}]
},
{
Assignments: [{Id: 0, Name: 'assignment', Notes: 'notes'}]
}]
this.teams.map((team:any) => {
team.Assignments.map((a: Assignment) => {
return this.videoService.getById(a.VideoId).subscribe(
res => {
let e = new Event();
e.Id = a.Id;
e.title = a.Name;
e.location = '';
e.message = a.Notes;
e.startDate = a.StartDate;
e.endDate = a.EndDate;
e.video = res;
e.team = team.Name;
this.eventList.push(e);
},
err => {
});
})
})
【问题讨论】:
-
@Makyen 对此感到抱歉,在顶部添加了我的数据的准系统数组,希望对您有所帮助。
标签: javascript angular rxjs