【发布时间】:2018-09-21 00:18:02
【问题描述】:
在从 API 获取结果后,我使用 subscribe 来执行代码行。这是我的代码
this.attRecService.getAgendaData(moment(this.viewDate).format('YYYY-MM')).subscribe(
resp => {
this.agendaData = resp;
for (let item of resp) {
if (item.schedule) {
for (let sched of item.schedule) {
this.events.push({
'start': new Date(moment(item.date).format('YYYY-MM-DD')),
'title': sched.title
});
}
}
}
},
() => {
console.log('display');
this.displayClockDetail();
}
);
但在我尝试控制台记录单词 display 的部分,它似乎不会进入该参数。怎么了?
【问题讨论】:
-
您缺少错误块
-
谢谢。我已经知道了@mxr7350
标签: angular typescript asynchronous subscription